Simplified condition check per claudep's suggestion.
Added documentation for #20784.