RESOLVED FIXED 234669
Modal containers are incorrectly detected in navigation elements and fixed document elements
https://bugs.webkit.org/show_bug.cgi?id=234669
Summary Modal containers are incorrectly detected in navigation elements and fixed do...
Wenson Hsieh
Reported 2021-12-24 12:19:38 PST
.
Attachments
Depends on #234652 (11.03 KB, patch)
2021-12-24 15:06 PST, Wenson Hsieh
no flags
Replace revealModalContainer calls with RAII helper (15.71 KB, patch)
2022-01-01 13:14 PST, Wenson Hsieh
no flags
Use WTF_MAKE_NONCOPYABLE (15.88 KB, patch)
2022-01-01 14:03 PST, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2021-12-24 15:06:51 PST
Created attachment 447948 [details] Depends on #234652
Radar WebKit Bug Importer
Comment 2 2021-12-31 12:20:27 PST
Darin Adler
Comment 3 2021-12-31 21:35:49 PST
Comment on attachment 447948 [details] Depends on #234652 View in context: https://bugs.webkit.org/attachment.cgi?id=447948&action=review > Source/WebCore/page/ModalContainerObserver.cpp:136 > +static AccessibilityRole accessibilityRole(const HTMLElement& element) > +{ > + return AccessibilityObject::ariaRoleToWebCoreRole(element.attributeWithoutSynchronization(HTMLNames::roleAttr)); > +} Not thrilled with the layering here. If the concept of a navigation element is needed outside the accessibility code, ideally we’d put the parsing of the role attribute in the core DOM implementation and have accessibility use that, rather than calling up to the accessibility code from the core DOM. > Source/WebCore/page/ModalContainerObserver.cpp:316 > + observer->revealModalContainer(); Seems unsafe to sprinkle this before 4 different return statements. Is there some more straightforward way to make sure we do this in all the appropriate cases?
Wenson Hsieh
Comment 4 2022-01-01 10:51:32 PST
Comment on attachment 447948 [details] Depends on #234652 View in context: https://bugs.webkit.org/attachment.cgi?id=447948&action=review Thanks for the review! >> Source/WebCore/page/ModalContainerObserver.cpp:136 >> +} > > Not thrilled with the layering here. If the concept of a navigation element is needed outside the accessibility code, ideally we’d put the parsing of the role attribute in the core DOM implementation and have accessibility use that, rather than calling up to the accessibility code from the core DOM. That makes sense. To clarify, are you suggesting that we should move `ariaRoleToWebCoreRole` into a method on `Element`, maybe as just `Element::accessibilityRole() const`, and then use that from both AX (and other parts of WebKit?). If my understanding is correct, I'll work on that refactoring separately. >> Source/WebCore/page/ModalContainerObserver.cpp:316 >> + observer->revealModalContainer(); > > Seems unsafe to sprinkle this before 4 different return statements. Is there some more straightforward way to make sure we do this in all the appropriate cases? It's a little bit tricky, since there are cases where we do want to continue hiding the detected modal container, depending on the client decision (and availability of controls we were able to detect in the "modal container"). However, after giving this some more thought, perhaps a RAII-like helper object might be appropriate here (with a method to explicitly prevent revealing the modal container upon destruction, that would be invoked in only one place). I'll do this refactoring as a part of this patch.
Darin Adler
Comment 5 2022-01-01 11:28:16 PST
Comment on attachment 447948 [details] Depends on #234652 View in context: https://bugs.webkit.org/attachment.cgi?id=447948&action=review >>> Source/WebCore/page/ModalContainerObserver.cpp:136 >>> +} >> >> Not thrilled with the layering here. If the concept of a navigation element is needed outside the accessibility code, ideally we’d put the parsing of the role attribute in the core DOM implementation and have accessibility use that, rather than calling up to the accessibility code from the core DOM. > > That makes sense. To clarify, are you suggesting that we should move `ariaRoleToWebCoreRole` into a method on `Element`, maybe as just `Element::accessibilityRole() const`, and then use that from both AX (and other parts of WebKit?). > > If my understanding is correct, I'll work on that refactoring separately. That is my suggestion. Might need a little bit other straightening up to make it a good core DOM concept, but yes. It doesn’t absolutely *have* to be a member function of the Element class -- there may be some value of putting it in a separate header -- but it should not be in the accessibility directory, since the accessibility is generally layered on top of the core DOM.
Wenson Hsieh
Comment 6 2022-01-01 12:25:25 PST
(In reply to Darin Adler from comment #5) > Comment on attachment 447948 [details] > Depends on #234652 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=447948&action=review > > >>> Source/WebCore/page/ModalContainerObserver.cpp:136 > >>> +} > >> > >> Not thrilled with the layering here. If the concept of a navigation element is needed outside the accessibility code, ideally we’d put the parsing of the role attribute in the core DOM implementation and have accessibility use that, rather than calling up to the accessibility code from the core DOM. > > > > That makes sense. To clarify, are you suggesting that we should move `ariaRoleToWebCoreRole` into a method on `Element`, maybe as just `Element::accessibilityRole() const`, and then use that from both AX (and other parts of WebKit?). > > > > If my understanding is correct, I'll work on that refactoring separately. > > That is my suggestion. Might need a little bit other straightening up to > make it a good core DOM concept, but yes. It doesn’t absolutely *have* to be > a member function of the Element class -- there may be some value of putting > it in a separate header -- but it should not be in the accessibility > directory, since the accessibility is generally layered on top of the core > DOM. Okay! Filed https://bugs.webkit.org/show_bug.cgi?id=234787 for this.
Wenson Hsieh
Comment 7 2022-01-01 13:14:08 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 8 2022-01-01 14:03:35 PST
Created attachment 448163 [details] Use WTF_MAKE_NONCOPYABLE
EWS
Comment 9 2022-01-01 15:07:33 PST
Committed r287505 (245640@main): <https://commits.webkit.org/245640@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448163 [details].
Note You need to log in before you can comment on or make changes to this bug.