New issue
Advanced search Search tips

Issue 698270 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Sep 19
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

<a is="action-link"> gains blue border it loses focus then regains focus.

Project Member Reported by hua...@chromium.org, Mar 3 2017

Issue description

Chrome Version: 58.0.3028.0 (64-bit)
OS: Win10 (should not matter)

What steps will reproduce the problem?
(1) Open chrome://settings, scroll to bottom "On Start Up".
(2) Click "Open a specific page or set of pages".
(3) Click "Use current pages".
(4) Alt-Tab (assuming some other tabs are open) away.
(5) Alt-Tab again.

What is the expected result?
"Use current pages" stay same as before.

What happens instead?
"Use current pages" gains blue border.

 
Owner: dbeam@chromium.org
Status: Assigned (was: Untriaged)
This related to  crbug.com/441233 . I think the cause is that in action_link.js, an :active link gains a blue border, and this is explicitly suppressed via ".no-outline" style if the link is clicked. But on blur (Alt-Tab away), the link loses ".no-outline". So once the page (and the link) it regains focus, the blue border comes back.

This affects crbug.com/697140.

Assigned to dbeam@.

Comment 2 by dbeam@chromium.org, Mar 3 2017

this would be hard to fix.  do we have to?  i'd just say WontFix.

Comment 3 by dbeam@chromium.org, Mar 3 2017

we'd have to somehow detect when focus is being sent back to the tab

right now, we just remove .no-outline on 'blur' (which is apparently dispatched when the window loses focus), add it when 'mousedown' is detected.
Can we flip the logic, and have no outline by default? Then on 'focus', if |this !== activeElement|, add '.outline' style; and on 'blur', always remove the style (or save .outline existence into a flag, which gets restored on 'focus' and gets cleared on 'keydown')?

Some complication probably will arise on timing re. activeElement assignment, and the need to differentiate keyboard vs. mouse navigation.

I'll be happy to give this a shot if you don't have time.  Thanks!

Comment 5 by dbeam@chromium.org, Mar 4 2017

Cc: dbeam@chromium.org
Owner: hua...@chromium.org
if you can perfectly match <a href>, I'm happy to review patches

Comment 6 by hua...@chromium.org, Mar 10 2017

Did more digging. So the border comes from :focus: If I override outline in :focus then I can remove it, BUT if I change other attribute in :focus (e.g., add background) then I'd change both mouse-select and key-select, but border only appears for key-select?!

Turns out the discrepancy goes into the C++ code:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp?l=145

In JS there's no easy way to distinguish mouse-select vs. key-select, but I found a simple solution that would address this scenario. Uploading CL soon.

Comment 7 by dbeam@chromium.org, Mar 10 2017

Status: Started (was: Assigned)
Summary: <a is="action-link"> gains blue border it loses focus then regains focus. (was: [Polymer] <action-link> gains blue border it loses focus then regains focus.)
(action-link uses custom elements directly and not really polymer, fwiw)
Project Member

Comment 8 by bugdroid1@chromium.org, Mar 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d5fc002027195691680b127e58458d1b2b86d5a1

commit d5fc002027195691680b127e58458d1b2b86d5a1
Author: huangs <huangs@chromium.org>
Date: Fri Mar 10 21:06:03 2017

[WebUI] Tweak action-link's .no-outline behavior on blur.

To emulate <a> :focus styling, action-link adds .no-outline on
mousedown, but removes .no-outline on blur. This indiscreminate removal
disregard the edge case where source of blur is from outside the web
page (e.g., Alt-Tab). This CL add an extra check to remedy this.

BUG= 698270 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2744893002
Cr-Commit-Position: refs/heads/master@{#456159}

[modify] https://crrev.com/d5fc002027195691680b127e58458d1b2b86d5a1/ui/webui/resources/js/action_link.js

Comment 9 by dbeam@chromium.org, Mar 10 2017

huangs@: i think what some would call a discrepancy, others would call a feature (as in: I'm pretty sure links are supposed to suppress focus outline on mouse, but not with key)
After the change, action-links *still* get focus outline if navigated by key. Moreover, after after Alt-Tab out and Alt-Tab back it keeps the outline.  What got changed is the case
(1) Click by mouse (no outline).
(2) Alt-Tab out.
(3) Alt-Tab back.
Before change: Outline appears.  After change: No outline. 
This is consistent with vanilla <a>.
Status: Fixed (was: Started)
Status: Assigned (was: Fixed)
Reopening bug: The fix http://crrev.com/2744893002 causes  bug 701268 , so I'm reverting it in http://crbug.com/2796663002.
Project Member

Comment 13 by bugdroid1@chromium.org, Apr 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/57a47c3f25ab6992306269e41e47374a59786f0a

commit 57a47c3f25ab6992306269e41e47374a59786f0a
Author: huangs <huangs@chromium.org>
Date: Mon Apr 03 19:47:54 2017

Revert of [WebUI] Tweak action-link's .no-outline removal behavior on blur. (patchset #1 id:1 of https://codereview.chromium.org/2744893002/ )

Reason for revert:
This fixes  http://crbug.com/698270  but leads to  http://crbug.com/701268 , which seems more serious.

Original issue's description:
> [WebUI] Tweak action-link's .no-outline behavior on blur.
>
> To emulate <a> :focus styling, action-link adds .no-outline on
> mousedown, but removes .no-outline on blur. This indiscreminate removal
> disregard the edge case where source of blur is from outside the web
> page (e.g., Alt-Tab). This CL add an extra check to remedy this.
>
> BUG= 698270 
> CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
>
> Review-Url: https://codereview.chromium.org/2744893002
> Cr-Commit-Position: refs/heads/master@{#456159}
> Committed: https://chromium.googlesource.com/chromium/src/+/d5fc002027195691680b127e58458d1b2b86d5a1

TBR=dbeam@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= 698270 

Review-Url: https://codereview.chromium.org/2796663002
Cr-Commit-Position: refs/heads/master@{#461508}

[modify] https://crrev.com/57a47c3f25ab6992306269e41e47374a59786f0a/ui/webui/resources/js/action_link.js

Status: Archived (was: Assigned)
Archiving old bugs that have only received trivial updates for some time.

If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!

Sign in to add a comment