RESOLVED FIXED 211118
Web Inspector: Computed: shouldn't display focus outline on click
https://bugs.webkit.org/show_bug.cgi?id=211118
Summary Web Inspector: Computed: shouldn't display focus outline on click
Nikita Vasilyev
Reported 2020-04-27 23:39:08 PDT
Created attachment 397813 [details] [Video] Bug In the computed panel, when clicking on the property it shows a clipped outline. There're two issues here: 1. Focus outline is clipped. 2. We shouldn't display focus outline on clicking at all. We should only display focus outline around the disclosure triangle when tabbing into it.
Attachments
[Video] Bug (1.69 MB, video/quicktime)
2020-04-27 23:39 PDT, Nikita Vasilyev
no flags
Patch (5.42 KB, patch)
2020-04-28 00:24 PDT, Nikita Vasilyev
no flags
[Video] With patch applied (1.26 MB, video/quicktime)
2020-04-28 00:25 PDT, Nikita Vasilyev
no flags
[Video] Jumping text (228.88 KB, video/quicktime)
2020-04-28 16:13 PDT, Nikita Vasilyev
no flags
Patch (5.41 KB, patch)
2020-04-28 16:33 PDT, Nikita Vasilyev
hi: review+
[Video] With patch applied (322.90 KB, video/quicktime)
2020-04-28 16:36 PDT, Nikita Vasilyev
no flags
Patch (5.82 KB, patch)
2020-04-30 18:57 PDT, Nikita Vasilyev
no flags
Radar WebKit Bug Importer
Comment 1 2020-04-27 23:39:18 PDT
Nikita Vasilyev
Comment 2 2020-04-28 00:24:34 PDT
Nikita Vasilyev
Comment 3 2020-04-28 00:25:21 PDT
Created attachment 397817 [details] [Video] With patch applied
Devin Rousso
Comment 4 2020-04-28 12:27:10 PDT
Comment on attachment 397816 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397816&action=review > Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:-40 > - overflow: hidden; > - text-overflow: ellipsis; I think this will have problems if a CSS property has a long non-word-breakable value, such as with `background-image`. > Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:49 > + outline-offset: -2px; This should be updated to use `var(--focus-ring-outline-offset)`. > Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:50 > + border-radius: 6px; How is `6px` determined? > Source/WebInspectorUI/UserInterface/Views/ExpandableView.js:32 > + this._disclosureButton = null; Why is this needed?
Nikita Vasilyev
Comment 5 2020-04-28 15:55:23 PDT
Comment on attachment 397816 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397816&action=review >> Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:-40 >> - text-overflow: ellipsis; > > I think this will have problems if a CSS property has a long non-word-breakable value, such as with `background-image`. You're right. This is limiting the size of the focus outline around the disclosure triangle but I can work with that. >> Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:50 >> + border-radius: 6px; > > How is `6px` determined? It's very odd to have square outline around the triangle. I don't think every pixel value should be justified. What are you suggesting? I can't find any focusable disclosure triangles on macOS Catalina right now — I remember previously seeing blue circle (filled in the middle, not a ring) for these cases. >> Source/WebInspectorUI/UserInterface/Views/ExpandableView.js:32 >> + this._disclosureButton = null; > > Why is this needed? Oops, it isn't. Left over from an unpublished patch.
Nikita Vasilyev
Comment 6 2020-04-28 15:58:44 PDT
Comment on attachment 397816 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397816&action=review >>> Source/WebInspectorUI/UserInterface/Views/ExpandableView.js:32 >>> + this._disclosureButton = null; >> >> Why is this needed? > > Oops, it isn't. Left over from an unpublished patch. ^ ignore my previous comment. I wanted to have `this._disclosureButton` always defined on the class - isn't what we usually want to do?
Devin Rousso
Comment 7 2020-04-28 16:03:11 PDT
Comment on attachment 397816 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397816&action=review >>> Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:50 >>> + border-radius: 6px; >> >> How is `6px` determined? > > It's very odd to have square outline around the triangle. I don't think every pixel value should be justified. What are you suggesting? > > I can't find any focusable disclosure triangles on macOS Catalina right now — I remember previously seeing blue circle (filled in the middle, not a ring) for these cases. I meant more "how did you come up with `6px`?". Is it based on the size of the triangle somehow? Is it something we could `calc` based on an existing variable? >>>> Source/WebInspectorUI/UserInterface/Views/ExpandableView.js:32 >>>> + this._disclosureButton = null; >>> >>> Why is this needed? >> >> Oops, it isn't. Left over from an unpublished patch. > > ^ ignore my previous comment. I wanted to have `this._disclosureButton` always defined on the class - isn't what we usually want to do? Yes and no. We want to have it defined if we expect it to be defined later in the object's lifetime (we especially want to make sure the type of the member stays the same), but we don't often bother creating a member variable if it is only defined once. In this case, `this._disclosureButton` is not defined (only used) after the object is constructed, so we shouldn't need to define it regardless. This is a similar case to what we do with `WI.NavigationItem` in many `WI.ContentView` subclasses.
Nikita Vasilyev
Comment 8 2020-04-28 16:13:32 PDT
Created attachment 397897 [details] [Video] Jumping text (In reply to Nikita Vasilyev from comment #5) > Comment on attachment 397816 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=397816&action=review > > >> Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:-40 > >> - text-overflow: ellipsis; > > > > I think this will have problems if a CSS property has a long non-word-breakable value, such as with `background-image`. > > You're right. This is limiting the size of the focus outline around the > disclosure triangle but I can work with that. Somehow `overflow: hidden` there makes text jump down 1px when focused. This is happening without my patch already. I don't understand where this's coming from.
Nikita Vasilyev
Comment 9 2020-04-28 16:33:53 PDT
Nikita Vasilyev
Comment 10 2020-04-28 16:36:19 PDT
Created attachment 397902 [details] [Video] With patch applied
Devin Rousso
Comment 11 2020-04-29 07:40:31 PDT
Comment on attachment 397900 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397900&action=review r=me, with a few comments/NITs > Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:35 > + min-height: calc(var(--disclosure-button-size) + 1px); /* The magic 1px is needed so the element doesn't move 1px down when .disclosure-button is focused. */ Is there no other way around this? This will end up "wasting" a lot of space :( > Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:51 > + outline-offset: -3px; /* Make focus outline smaller than usual so it doesn't get clipped here. */ This should be `calc(var(--focus-ring-outline-offset) - 1px)` > Source/WebInspectorUI/UserInterface/Views/ExpandableView.js:67 > + if (this._disclosureButton) > + this._disclosureButton.ariaExpanded = isExpanded; NIT: if you use `Element.prototype.setAttribute`, you can do this on one line with optional chaining =D ``` this._disclosureButton?.setAttribute("aria-expanded", isExpanded); ```
Nikita Vasilyev
Comment 12 2020-04-30 18:50:27 PDT
Comment on attachment 397900 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397900&action=review >> Source/WebInspectorUI/UserInterface/Views/ComputedStyleSection.css:51 >> + outline-offset: -3px; /* Make focus outline smaller than usual so it doesn't get clipped here. */ > > This should be `calc(var(--focus-ring-outline-offset) - 1px)` I don't think we should do this. If --focus-ring-outline-offset changes, it may break here.
Nikita Vasilyev
Comment 13 2020-04-30 18:57:31 PDT
Created attachment 398137 [details] Patch I finally figured out a workaround for the jiggly elements. Now only the expanded element has the half a pixel borders.
Nikita Vasilyev
Comment 14 2020-04-30 18:58:15 PDT
(In reply to Nikita Vasilyev from comment #13) > Created attachment 398137 [details] > Patch > > I finally figured out a workaround for the jiggly elements. Now only the > expanded element has the half a pixel borders. ...and it doesn't take any more space than before the patch.
EWS
Comment 15 2020-04-30 19:20:48 PDT
Committed r260978: <https://trac.webkit.org/changeset/260978> All reviewed patches have been landed. Closing bug and clearing flags on attachment 398137 [details].
Note You need to log in before you can comment on or make changes to this bug.