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 #805 don't blur() the trigger after a clipboard action #807

Merged
merged 3 commits into from
May 4, 2022

Conversation

patrickhlauke
Copy link
Contributor

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

This PR reintroduces the behavior that used to be in clipboard.js following #419 but that has since been reverted for some reason. As such, after a clipboard action, focus will remain/be on the trigger element, rather than the body. If applications rely on the focus to be gone/removed from the trigger button, they'll need to adapt to this.

The PR fulfills these requirements:

  • It's submitted to the dev branch for v2.x (or to a previous version branch), not the master branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • New/updated tests are included

I didn't target v2.x branch because it looks wildly out of date.

Other information:

I'm not too hot on writing tests, so rather than just removing the check to see if focus is now on the body, it should probably explicitly check that focus remained on the trigger. However, not quite sure how to do that - my knowledge of test harnesses etc is pretty basic.

Closes #805

It's pointless to set `focus()` on the trigger first, if in the next step you're just going to `blur()` the active element anyway.
Since it's now not `blur()`ing anymore
Copy link
Collaborator

@obetomuniz obetomuniz left a comment

Choose a reason for hiding this comment

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

Looks great to me. I just left feedback to consider before merging related to the test related to the PR. Thanks a lot for the PR.

Copy link
Collaborator

@obetomuniz obetomuniz left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks a lot for this contribution, @patrickhlauke. In the next few days, we'll be releasing this PR in a brand new version 👏👏👏

@patrickhlauke
Copy link
Contributor Author

wonderful! thank you.

Copy link
Collaborator

@helderberto helderberto left a comment

Choose a reason for hiding this comment

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

Great job! Thanks for the contribution.

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.

Trigger loses focus after copy event
3 participants