Changeset 289521 in webkit


Ignore:
Timestamp:
Feb 10, 2022 12:10:04 AM (5 months ago)
Author:
Manuel Rego Casasnovas
Message:

:focus-visible with click on radio/checkbox labels is broken
https://bugs.webkit.org/show_bug.cgi?id=236331

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Added new WPT test to cover this case.

  • web-platform-tests/css/selectors/focus-visible-026-expected.txt: Added.
  • web-platform-tests/css/selectors/focus-visible-026.html: Added.

Source/WebCore:

When the label is clicked we have to send the FocusTrigger information to Element::focus().
There we avoid setting FocusVisibility:Visible if it has been triggered via mouse click.

Test: imported/w3c/web-platform-tests/css/selectors/focus-visible-026.html

  • dom/Element.cpp:

(WebCore::Element::focus): Add a check for FocusTrigger::Click to avoid setting FocusVisibility:Visible.

  • html/HTMLLabelElement.cpp:

(WebCore::HTMLLabelElement::defaultEventHandler): Pass FocusTrigger::Click.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r289516 r289521  
     12022-02-10  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        :focus-visible with click on radio/checkbox labels is broken
     4        https://bugs.webkit.org/show_bug.cgi?id=236331
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Added new WPT test to cover this case.
     9
     10        * web-platform-tests/css/selectors/focus-visible-026-expected.txt: Added.
     11        * web-platform-tests/css/selectors/focus-visible-026.html: Added.
     12
    1132022-02-09  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r289518 r289521  
     12022-02-10  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        :focus-visible with click on radio/checkbox labels is broken
     4        https://bugs.webkit.org/show_bug.cgi?id=236331
     5
     6        Reviewed by Antti Koivisto.
     7
     8        When the label is clicked we have to send the FocusTrigger information to Element::focus().
     9        There we avoid setting FocusVisibility:Visible if it has been triggered via mouse click.
     10
     11        Test: imported/w3c/web-platform-tests/css/selectors/focus-visible-026.html
     12
     13        * dom/Element.cpp:
     14        (WebCore::Element::focus): Add a check for FocusTrigger::Click to avoid setting FocusVisibility:Visible.
     15        * html/HTMLLabelElement.cpp:
     16        (WebCore::HTMLLabelElement::defaultEventHandler): Pass FocusTrigger::Click.
     17
    1182022-02-09  Said Abou-Hallawa  <said@apple.com>
    219
  • trunk/Source/WebCore/dom/Element.cpp

    r289498 r289521  
    31103110        if (options.trigger == FocusTrigger::Bindings && document->wasLastFocusByClick())
    31113111            optionsWithVisibility.visibility = FocusVisibility::Invisible;
    3112         else
     3112        else if (options.trigger != FocusTrigger::Click)
    31133113            optionsWithVisibility.visibility = FocusVisibility::Visible;
    31143114
  • trunk/Source/WebCore/html/HTMLLabelElement.cpp

    r289246 r289521  
    158158        document().updateLayoutIgnorePendingStylesheets();
    159159        if (control->isMouseFocusable())
    160             control->focus();
     160            control->focus({ { }, { }, { }, FocusTrigger::Click, { } });
    161161
    162162        processingClick = false;
Note: See TracChangeset for help on using the changeset viewer.