Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update autofocus algorithm #4645

Closed
tkent-google opened this issue May 21, 2019 · 6 comments
Closed

Update autofocus algorithm #4645

tkent-google opened this issue May 21, 2019 · 6 comments

Comments

@tkent-google
Copy link
Contributor

@tkent-google
Copy link
Contributor Author

  • Handle a case where an element with autofocus is connected and then disconnected before focused.

I think it's done by just adding connected check to the autofocus steps.

  • First step of the algorithm is too vague

We should specify as much as possible to improve interoperability. IMO we should standardize the Firefox behavior. How about changing the first step to:

  1. If focus update steps has been executed in element's node document, then return.
    if the scroll position of element's node document is different from the initial one, then return.

@bzbarsky @rniwa What do you think?

@rniwa
Copy link

rniwa commented May 24, 2019

What are you referring to by "the Firefox behavior"? What do other browsers do today? Are you talking about waiting until all pending stylesheets are loaded??

@tkent-google
Copy link
Contributor Author

What are you referring to by "the Firefox behavior"?

It's web-platform-tests/wpt#16780 (comment) . That is to say, Firefox doesn't handle autofocus if any element was focused beforehand, and Firefox doesn't handle autofocus if the page was loaded with a fragment anchor.

What do other browsers do today?

Neither of WebKit nor Blink do them today. However, I (as a Blink dev) prefer the Firefox behavior.

Are you talking about waiting until all pending stylesheets are loaded??

No in this issue. It's discussed in #3551.

@tkent-google
Copy link
Contributor Author

@bzbarsky Do you think #4645 (comment) is reasonable?

@domenic
Copy link
Member

domenic commented Jun 10, 2019

@smaug---- as well as I hear he has been closer to focus stuff (although @bzbarsky filed some of the initial issues).

tkent-google added a commit to tkent-google/html that referenced this issue Jul 11, 2019
- Run focusing steps after an animation frame
- Don't autofocus if the top-level document has focused area
- Don't autofocus if one of ancestor document has :target element.

This fixes whatwg#3551 and whatwg#4645
@tkent-google
Copy link
Contributor Author

I posted a specification PR to resolve this issue: #4763

tkent-google added a commit to tkent-google/html that referenced this issue Sep 3, 2019
- Run focusing steps after an animation frame
- Don't autofocus if the top-level document has focused area
- Don't autofocus if one of ancestor document has :target element.

This fixes whatwg#3551 and whatwg#4645
@domenic domenic closed this as completed in 2d783db Sep 3, 2019
zcorpan pushed a commit that referenced this issue Nov 6, 2019
* Run focusing steps after an animation frame
* Don't autofocus if the top-level document has focused area
* Don't autofocus if one of ancestor document has a :target element

Fixes #3551.  Fixes #4645.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants