Bug 1892529: Skip hidden radio buttons when determining which radio button to focus. r=smaug
This fixes two problems: 1. If no radio button is checked and the first radio button is hidden, tabbing will reach the first visible radio button in the group, rather than just skipping the group. 2. If you press down arrow or up arrow and the next/previous radio button is hidden, focus will move to the next/previous visible radio button in the group, rather than doing nothing. Differential Revision: https://phabricator.services.mozilla.com/D208092
This commit is contained in:
@@ -3790,6 +3790,12 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
||||
if (mType == FormControlType::InputRadio && keyEvent->IsTrusted() &&
|
||||
!keyEvent->IsAlt() && !keyEvent->IsControl() &&
|
||||
!keyEvent->IsMeta()) {
|
||||
// Radio button navigation needs to check visibility, so flush
|
||||
// to ensure visibility is up to date.
|
||||
if (Document* doc = GetComposedDoc()) {
|
||||
doc->FlushPendingNotifications(
|
||||
FlushType::EnsurePresShellInitAndFrames);
|
||||
}
|
||||
rv = MaybeHandleRadioButtonNavigation(aVisitor, keyEvent->mKeyCode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user