RESOLVED FIXED 200997
SVG element should not become focusable when focus and key event listeners are added
https://bugs.webkit.org/show_bug.cgi?id=200997
Summary SVG element should not become focusable when focus and key event listeners ar...
Ryosuke Niwa
Reported 2019-08-21 14:01:10 PDT
SVGElement::isMouseFocusable() has bizarre code which checks the presence of keydown, keyup, keypress, focusin, focusout, focus, and blur event listeners. We shouldn't make an element focusable just because it has a bunch of event listeners.
Attachments
Patch (12.71 KB, patch)
2019-08-21 16:15 PDT, Ryosuke Niwa
sabouhallawa: review+
Ryosuke Niwa
Comment 1 2019-08-21 16:15:18 PDT
Said Abou-Hallawa
Comment 2 2019-08-21 17:21:38 PDT
Comment on attachment 376945 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376945&action=review > Source/WebCore/svg/SVGAElement.cpp:162 > if (hasEditableStyle()) > return SVGGraphicsElement::supportsFocus(); How can this element be editable? > LayoutTests/svg/custom/tabindex-order.html:66 > + <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> I think you do not have to add these namespaces in html. The xlink namespaces is removed in SVG2 beside it is not used in this test. > LayoutTests/svg/custom/tabindex-order.html:68 > + <rect class="tab" id="rect without tabindex is not focusable" width="1" height="1"/> I am not sure why the id's contains white spaces. I see they are not referenced but they look weird to me. You may use comment element <!-- --> instead.
Ryosuke Niwa
Comment 3 2019-08-21 17:29:04 PDT
(In reply to Said Abou-Hallawa from comment #2) > Comment on attachment 376945 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=376945&action=review > > > Source/WebCore/svg/SVGAElement.cpp:162 > > if (hasEditableStyle()) > > return SVGGraphicsElement::supportsFocus(); > > How can this element be editable? You can put contenteditble attribute anywhere, or put the entire document into design mode by document.designMode = 'on'. > > LayoutTests/svg/custom/tabindex-order.html:66 > > + <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> > > I think you do not have to add these namespaces in html. The xlink > namespaces is removed in SVG2 beside it is not used in this test. Yeah, I added for some testing. Removed. > > LayoutTests/svg/custom/tabindex-order.html:68 > > + <rect class="tab" id="rect without tabindex is not focusable" width="1" height="1"/> > > I am not sure why the id's contains white spaces. I see they are not > referenced but they look weird to me. You may use comment element <!-- --> > instead. Well, these IDs are like that because if they ever get focused, it would show up in the test result. The rest of the test uses that convention so I'd keep that for now.
Ryosuke Niwa
Comment 4 2019-08-21 17:29:22 PDT
Thanks for the review!
Ryosuke Niwa
Comment 5 2019-08-21 17:34:50 PDT
Radar WebKit Bug Importer
Comment 6 2019-08-21 17:35:17 PDT
Ryosuke Niwa
Comment 7 2022-07-15 22:27:30 PDT
*** Bug 140024 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.