Closed
Bug 1514570
Opened 7 years ago
Closed 7 years ago
Only graphics elements should support tabindex
Categories
(Core :: SVG, enhancement)
Core
SVG
Tracking
()
RESOLVED
FIXED
mozilla66
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: longsonr, Assigned: longsonr)
References
()
Details
Attachments
(2 files, 3 obsolete files)
5.39 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
2.79 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → longsonr
Assignee | ||
Comment 1•7 years ago
|
||
Gets us closer to the other UAs.
https://www.w3.org/TR/SVG2/interact.html#Focus
In Part 2 I'll implement support for focusable.
Attachment #9031765 -
Flags: review?(dholbert)
Assignee | ||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Comment on attachment 9031765 [details] [diff] [review]
Part 1 - Move code to SVGGraphicsElement but special case <defs>
Review of attachment 9031765 [details] [diff] [review]:
-----------------------------------------------------------------
r=me, two nits:
::: dom/svg/SVGDefsElement.h
@@ +28,5 @@
> // nsIContent
> NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
>
> + bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override {
> + return nsIContent::IsFocusableInternal(aTabIndex, aWithMouse);
Right now it's unclear that this method's implementation is really just a strict "no I'm not focusable". Could you add a comment to make that clearer?
Also: it seems bizarre that SVGDefsElement inherits from SVGGraphicsElement in the first place (which is the reason this explicit IsFocusableInternal impl is needed here in the first place). If you know the reason for that inheritance relationship, perhaps you could also add a brief comment above the "class SVGDefsElement final : public SVGGraphicsElement" line to hint at the reason?
::: dom/svg/SVGGraphicsElement.cpp
@@ +28,4 @@
>
> SVGGraphicsElement::~SVGGraphicsElement() {}
>
> +bool SVGGraphicsElement::IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex) {
This line is too long -- the args list needs to be wrapped here, to look like this:
bool SVGGraphicsElement::IsSVGFocusable(bool* aIsFocusable,
int32_t* aTabIndex) {
("./mach clang-format" will actually make that change for you on its own, if you've got it configured. That's how I found that this needed to happen. :))
Attachment #9031765 -
Flags: review?(dholbert) → review+
Comment 4•7 years ago
|
||
Comment on attachment 9031765 [details] [diff] [review]
Part 1 - Move code to SVGGraphicsElement but special case <defs>
Review of attachment 9031765 [details] [diff] [review]:
-----------------------------------------------------------------
::: testing/web-platform/meta/svg/interact/scripted/tabindex-focus-flag.svg.ini
@@ +21,3 @@
> expected: FAIL
>
> + [unknown[tabindex\] should be focusable.]
Also, it looks like these "should be focusable" failure annotations are new in this patch. (for "mesh" and "unknown")
Can you be sure we've got bugs tracking those new failures? (Or, maybe the "Part 2" patch that you mentioned in comment 1 will address these?)
Assignee | ||
Comment 5•7 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #3)
> Also: it seems bizarre that SVGDefsElement inherits from SVGGraphicsElement
> in the first place (which is the reason this explicit IsFocusableInternal
> impl is needed here in the first place). If you know the reason for that
> inheritance relationship, perhaps you could also add a brief comment above
> the "class SVGDefsElement final : public SVGGraphicsElement" line to hint at
> the reason?
That's from the SVG 2 spec. The spec is just odd here.
Assignee | ||
Comment 6•7 years ago
|
||
>
> Can you be sure we've got bugs tracking those new failures? (Or, maybe the
> "Part 2" patch that you mentioned in comment 1 will address these?)
Nope, we simply don't support SVGUnknownElement (no browser does), nor do we support mesh elements. When all elements were focusable they got the default nsSVGElement focusable behaviour and they still do but that has changed.
bug 1239218 is for SVGUnknownElement, bug 1238882 is for mesh. Those bugs would implement support in passing.
Assignee | ||
Updated•7 years ago
|
Keywords: leave-open
Pushed by longsonr@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/608ea24efe57
Only graphics elements should support tabindex r=dholbert
Assignee | ||
Comment 8•7 years ago
|
||
Attachment #9031989 -
Flags: review?(dholbert)
Assignee | ||
Comment 9•7 years ago
|
||
Attachment #9031990 -
Flags: review?(dholbert)
Assignee | ||
Comment 10•7 years ago
|
||
Attachment #9031989 -
Attachment is obsolete: true
Attachment #9031989 -
Flags: review?(dholbert)
Attachment #9031994 -
Flags: review?(dholbert)
Comment 11•7 years ago
|
||
bugherder |
Comment 12•7 years ago
|
||
As I look at part 2, I'm realizing that the return value from this function...
> virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
https://searchfox.org/mozilla-central/rev/13788edbabb04d004e4a1ceff41d4de68a8320a2/dom/svg/SVGGraphicsElement.h#28
...is non-intuitive. Particularly for cases where we do:
*aIsFocuable = false;
return true;
...like in the code being extended in part 2.
Could you add some documentation to SVGGraphicsElement.h to indicate what the return value means and when/whether callers need to bother checking it? (At first glance, I'm seeing one caller that does check it, and one that does not.)
Flags: needinfo?(longsonr)
Assignee | ||
Comment 13•7 years ago
|
||
as far as I can tell with the return value true means "this is a definitive result" or and false means "caller might override this"
Flags: needinfo?(longsonr)
Assignee | ||
Comment 14•7 years ago
|
||
I've added your part 2 review comment into part 3 as it was easier that way.
Attachment #9031990 -
Attachment is obsolete: true
Attachment #9031990 -
Flags: review?(dholbert)
Attachment #9032274 -
Flags: review?(dholbert)
Comment 15•7 years ago
|
||
Comment on attachment 9031994 [details] [diff] [review]
Part 2 - support the focusable attribute
Review of attachment 9031994 [details] [diff] [review]:
-----------------------------------------------------------------
r- for the moment due to the focusable=false concern:
::: dom/svg/SVGGraphicsElement.cpp
@@ +42,5 @@
>
> + const nsAttrValue* val =
> + mAttrs.GetAttr(nsGkAtoms::focusable, kNameSpaceID_None);
> + if (val && val->Equals(nsGkAtoms::_false, eCaseMatters)) {
> + *aIsFocusable = false;
So you're giving special significance to focusable="false" here (making it "win" and force something to be non-focusable, when it otherwise would've been treated as focusable due to e.g. a "tabindex" being provided.)
I don't see support for this focusable="false" behavior in the spec, though. https://www.w3.org/TR/SVG2/interact.html#Focus *only* mentions behavior for elements with focusable=true (they are considered to be focusable), and it doesn't mention any special semantics for "false".
Given that the spec text seems to be a halfhearted attempt at backwards-compatibility & that it suggests authors avoid this attribute altogether, it doesn't sound like this attr is meant to be fully-featured. So we should probably omit this part (or get the spec updated to clarify who "wins" between focusable=false & tabindex=0)
@@ +53,5 @@
> *aTabIndex = tabIndex;
> }
>
> + // If a tabindex is specified at all, or the default tabindex is 0,
> + // or focusable="true" we're focusable
Let's put a colon (or a comma) after "true" so that this sentence is easier to read.
i.e.
"If A, or B, or C: we're focusable"
rather than
"...or C we're focusable"
Attachment #9031994 -
Flags: review?(dholbert) → review-
Assignee | ||
Comment 16•7 years ago
|
||
OK, mind reviewing part 3 anyway, it's independent of part 2. If we want to do focusable we can do it in another bug.
Comment hidden (obsolete) |
Comment 18•7 years ago
|
||
So here's what I'm gleaning while trying to grok part 3:
- IsSVGFocusable only exists to be a helper for the IsFocusableInternal API
- Right now, SVGAElement gives itself some special behavior by overriding IsSVGFocusable
- ...but instead it can just directly override the higher-level API.
- And then, the IsSVGFocusable helper doesn't have any overrides, so it can be devirtualized.
Does that sum it up?
FWIW, it might be nice to capture some version of that ^^ (if it's correct) in the extended commit message, for the benefit of people staring at this commit in the future (e.g. regression-range-hunting)
Comment 19•7 years ago
|
||
Comment on attachment 9032274 [details] [diff] [review]
Part 3 - make IsSVGFocusable non-virtual (with review comment)
Review of attachment 9032274 [details] [diff] [review]:
-----------------------------------------------------------------
This seems fine (and is a nice devirtualization win)
I wish we had more clearly-defined separation-of-concerns between the various functions here... but, this patch seems like a logical & valid evolution from where we're at right now.
Attachment #9032274 -
Flags: review?(dholbert) → review+
Assignee | ||
Comment 20•7 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #18)
> So here's what I'm gleaning while trying to grok part 3:
> - IsSVGFocusable only exists to be a helper for the IsFocusableInternal API
> - Right now, SVGAElement gives itself some special behavior by overriding
> IsSVGFocusable
> - ...but instead it can just directly override the higher-level API.
> - And then, the IsSVGFocusable helper doesn't have any overrides, so it can
> be devirtualized.
>
> Does that sum it up?
>
> FWIW, it might be nice to capture some version of that ^^ (if it's correct)
> in the extended commit message, for the benefit of people staring at this
> commit in the future (e.g. regression-range-hunting)
That's it. I'll add an extended commit message as you suggest.
I too am unhappy with how its designed but this is as far as I got in fixing it.
Assignee | ||
Comment 21•7 years ago
|
||
Looks like we match Chrome and Safari now. Only Edge supports focusable, and Edge doesn't seem to do tabindex very well for SVG content.
Assignee | ||
Updated•7 years ago
|
Keywords: leave-open
Comment 22•7 years ago
|
||
Pushed by longsonr@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5c5537adc555
devirtualise IsSVGFocusable by having SVGAElement (its only override) directly override the higher level IsFocusableInternal API r=dholbert
Comment 23•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox66:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in
before you can comment on or make changes to this bug.
Description
•