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

fix(4995): dynamically set autofocus #5070

Closed
wants to merge 1 commit into from
Closed

fix(4995): dynamically set autofocus #5070

wants to merge 1 commit into from

Conversation

skippednote
Copy link
Contributor

fixes #4995

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases, features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests with npm test or yarn test)

Copy link
Member

@Conduitry Conduitry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell looking at the compiled code, this will unconditionally call .focus() on elements as they are mounted (whether or not the autofocus={foo} expression is truthy), and won't call it again later if foo changes.

The first seems incorrect. If we want to support autofocus={foo}, at the very least it should only focus upon mounting if foo is true at that moment. I don't really have an opinion about how it should be handled later on, though. Maybe if foo ever changes from falsy to truthy we should .focus() again? I'm not sure.

@Conduitry Conduitry marked this pull request as draft July 30, 2020 15:34
@Conduitry Conduitry closed this Aug 15, 2020
@bluwy bluwy mentioned this pull request Jul 5, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autofocus HTML attribute not working with curly braces JavaScript expression
3 participants