Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
focusing of disabled fieldset element is not prevented
focusing of disabled fieldset element is not prevented

https://bugs.webkit.org/show_bug.cgi?id=141086

Reviewed by Ryosuke Niwa.

Merge - https://chromium.googlesource.com/chromium/src.git/+/1637db318e525b5c1e3a960eeb59dee151f049ca

It is to align with web-specification and both Gecko and Blink.

https://html.spec.whatwg.org/multipage/semantics-other.html#concept-element-disabled

* Source/WebCore/html/HTMLFieldSetElement.cpp:
(HTMLFieldSetElement::supportsFocus()) - Modify to add !isDisabledFormControl logic to check before focusing.
* LayoutTests/fast/forms/fieldset/fieldset-disabled.html: Modified to accomodate "tabindex' case.
* LayoutTests/fast/forms/fieldset/fieldset-disabled-expected.txt: Updated Expectations for 'tabindex' case

Canonical link: https://commits.webkit.org/253993@main
  • Loading branch information
Ahmad Saleem authored and rniwa committed Aug 31, 2022
1 parent 2a66dfb commit 8ddd66f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Expand Up @@ -88,6 +88,7 @@ PASS legendFieldSet.disabled is false
PASS insertedLegendTextInput.value is "JJJK"
PASS firstLegendTextInput.value is "IIK"
PASS secondLegendTextInput.value is "K"
PASS disabledFieldsetWithTabindex.focus(); document.activeElement is document.body
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
6 changes: 6 additions & 0 deletions LayoutTests/fast/forms/fieldset/fieldset-disabled.html
Expand Up @@ -31,6 +31,8 @@
<input type="text" id="parserGeneratedInput9">
</fieldset>
</form>
<fieldset tabindex=0 disabled id="fieldset-tabindex"></fieldset>
</form>

<script>
description('Tests for HTMLFieldSetElement.disabled behavior.');
Expand Down Expand Up @@ -291,6 +293,10 @@
shouldBe('firstLegendTextInput.value', '"IIK"');
shouldBe('secondLegendTextInput.value', '"K"');

var disabledFieldsetWithTabindex = document.getElementById('fieldset-tabindex');
document.activeElement.blur();
shouldBe('disabledFieldsetWithTabindex.focus(); document.activeElement', 'document.body');

document.body.removeChild(document.getElementsByTagName('form')[0]);
document.body.removeChild(fieldSet);
document.body.removeChild(outerFieldSet);
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/HTMLFieldSetElement.cpp
Expand Up @@ -150,7 +150,7 @@ bool HTMLFieldSetElement::matchesInvalidPseudoClass() const

bool HTMLFieldSetElement::supportsFocus() const
{
return HTMLElement::supportsFocus();
return HTMLElement::supportsFocus() && !isDisabledFormControl();
}

const AtomString& HTMLFieldSetElement::formControlType() const
Expand Down

0 comments on commit 8ddd66f

Please sign in to comment.