Bug 1267488: If no HTML input radio in a group is checked, only make the first radio in the group tabbable instead of all of them. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D202681
This commit is contained in:
James Teh
2024-03-08 07:03:28 +00:00
parent de27a63690
commit 0cab7c24b4
8 changed files with 110 additions and 7 deletions

View File

@@ -6480,7 +6480,8 @@ bool HTMLInputElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
}
// Current radio button is not selected.
// But make it tabbable if nothing in group is selected.
// Make it tabbable if nothing in group is selected and it is the first radio
// button.
auto* container = GetCurrentRadioGroupContainer();
if (!container) {
*aIsFocusable = defaultFocusable;
@@ -6490,7 +6491,8 @@ bool HTMLInputElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
nsAutoString name;
GetAttr(nsGkAtoms::name, name);
if (container->GetCurrentRadioButton(name)) {
if (container->GetCurrentRadioButton(name) ||
container->GetFirstRadioButton(name) != this) {
*aTabIndex = -1;
}
*aIsFocusable = defaultFocusable;