RESOLVED FIXED Bug 160705
AX: @alt and bounds ignored when using img[src] points to an inaccessible SVG
https://bugs.webkit.org/show_bug.cgi?id=160705
Summary AX: @alt and bounds ignored when using img[src] points to an inaccessible SVG
James Craig
Reported 2016-08-09 13:11:18 PDT
Test case from Deque http://a11yideas.com/testcode/mwp/iOSsvg.html If you link an entirely inaccessible SVG (no accessible contents), WebKit should respect the @alt attribute from the linking HTML, use the outer bounds of the SVG canvas as the image bounds, and use the AXImage role instead of AXGroup.
Attachments
Patch (14.43 KB, patch)
2021-01-22 14:32 PST, Andres Gonzalez
no flags
Patch (14.95 KB, patch)
2021-01-23 11:28 PST, Andres Gonzalez
no flags
Patch (17.33 KB, patch)
2021-01-25 07:57 PST, Andres Gonzalez
no flags
Radar WebKit Bug Importer
Comment 1 2016-08-09 13:11:37 PDT
James Craig
Comment 2 2016-08-09 13:18:28 PDT
See related discussion from bug 145263.
Andres Gonzalez
Comment 3 2021-01-22 14:32:55 PST
chris fleizach
Comment 4 2021-01-22 14:38:18 PST
Comment on attachment 418181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418181&action=review > Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 > + for (const auto& child : childrenOfType<SVGElement>(element)) { the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again
chris fleizach
Comment 5 2021-01-22 14:57:31 PST
Comment on attachment 418181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418181&action=review > Source/WebCore/accessibility/AccessibilitySVGElement.cpp:72 > + // If the role or aria-label attributes are specified, this is accessible. are there other attributes we need to check like "alt"
Darin Adler
Comment 6 2021-01-22 16:04:19 PST
Comment on attachment 418181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418181&action=review >> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >> + for (const auto& child : childrenOfType<SVGElement>(element)) { > > the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again Using descendantsOfType instead, only at the top level, should resolve that cleanly.
Darin Adler
Comment 7 2021-01-22 16:18:17 PST
Comment on attachment 418181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418181&action=review >>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >>> + for (const auto& child : childrenOfType<SVGElement>(element)) { >> >> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again > > Using descendantsOfType instead, only at the top level, should resolve that cleanly. But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once.
chris fleizach
Comment 8 2021-01-22 16:23:45 PST
(In reply to Darin Adler from comment #7) > Comment on attachment 418181 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418181&action=review > > >>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 > >>> + for (const auto& child : childrenOfType<SVGElement>(element)) { > >> > >> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again > > > > Using descendantsOfType instead, only at the top level, should resolve that cleanly. > > But on reflection, I don’t think it will be n! or n^2; even in this code > every descendant is visited only once. yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot
Darin Adler
Comment 9 2021-01-22 16:29:54 PST
Comment on attachment 418181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418181&action=review >>>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >>>>> + for (const auto& child : childrenOfType<SVGElement>(element)) { >>>> >>>> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again >>> >>> Using descendantsOfType instead, only at the top level, should resolve that cleanly. >> >> But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once. > > yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot Oh, yes this is O(descendants) and it’s *not* OK to call something like that for all elements. Could be a real challenge to deal with that.
chris fleizach
Comment 10 2021-01-22 17:19:35 PST
Comment on attachment 418181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418181&action=review >>>>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 >>>>>> + for (const auto& child : childrenOfType<SVGElement>(element)) { >>>>> >>>>> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again >>>> >>>> Using descendantsOfType instead, only at the top level, should resolve that cleanly. >>> >>> But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once. >> >> yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot > > Oh, yes this is O(descendants) and it’s *not* OK to call something like that for all elements. > > Could be a real challenge to deal with that. talking to Andres offline we determined this would only be called once and only on the root. he had some ideas on how to make that more clear in the code
Andres Gonzalez
Comment 11 2021-01-23 11:28:10 PST
Andres Gonzalez
Comment 12 2021-01-23 11:33:02 PST
(In reply to chris fleizach from comment #10) > Comment on attachment 418181 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418181&action=review > > >>>>>> Source/WebCore/accessibility/AccessibilitySVGElement.cpp:78 > >>>>>> + for (const auto& child : childrenOfType<SVGElement>(element)) { > >>>>> > >>>>> the code block worries me. it seems like it's going to be a n! algorithm. for every child, you're going to call into this same method for every descendant. and then at the next level, you'll call that same method again > >>>> > >>>> Using descendantsOfType instead, only at the top level, should resolve that cleanly. > >>> > >>> But on reflection, I don’t think it will be n! or n^2; even in this code every descendant is visited only once. > >> > >> yea I was thinking if this has to be called at every level of the tree for every element, we'd end up descending a lot > > > > Oh, yes this is O(descendants) and it’s *not* OK to call something like that for all elements. > > > > Could be a real challenge to deal with that. > > talking to Andres offline we determined this would only be called once and > only on the root. he had some ideas on how to make that more clear in the > code I moved the hasAccessibleContent method to the AccessibilitySVGRoot class which makes it clearer that this method would be called only on the SVG root. Also used the descendantsOfType function suggested by Darin that makes it a lot cleaner. Thank you both very much for the feedback.
Andres Gonzalez
Comment 13 2021-01-23 11:36:16 PST
(In reply to chris fleizach from comment #5) > Comment on attachment 418181 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418181&action=review > > > Source/WebCore/accessibility/AccessibilitySVGElement.cpp:72 > > + // If the role or aria-label attributes are specified, this is accessible. > > are there other attributes we need to check like "alt" Investigating this. have to consult the ARIA and SVG accessibility specs.
Andres Gonzalez
Comment 15 2021-01-25 07:57:49 PST
EWS
Comment 16 2021-01-25 08:52:57 PST
Committed r271796: <https://trac.webkit.org/changeset/271796> All reviewed patches have been landed. Closing bug and clearing flags on attachment 418295 [details].
chris fleizach
Comment 17 2021-03-15 12:31:45 PDT
*** Bug 202431 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.