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

Trigger loses focus after copy event #695

Closed
adamgruber opened this issue Aug 23, 2020 · 11 comments
Closed

Trigger loses focus after copy event #695

adamgruber opened this issue Aug 23, 2020 · 11 comments

Comments

@adamgruber
Copy link

This line of code was added in v2.0.5 that caused a breaking change. I was unable to find a reason for the addition in the commit logs but the behavior is such that calling clearSelection no longer behaves as expected.

Behavior in 2.0.4

Calling clearSelection returns focus to the trigger

Behavior in 2.0.5+

Calling clearSelection returns focus to the trigger THEN is subsequently cleared by calling document.activeElement.blur()

Can you provide any insight on the reason for this change? It seems like a bug to me.

@stale
Copy link

stale bot commented Oct 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 22, 2020
@adamgruber
Copy link
Author

@zenorocha Any thoughts/comments on this?

@stale stale bot removed the stale label Oct 28, 2020
@stale
Copy link

stale bot commented Dec 27, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 27, 2020
@adamgruber
Copy link
Author

Bump

@stale stale bot removed the stale label Dec 27, 2020
@ktfth
Copy link
Collaborator

ktfth commented Jan 19, 2021

@adamgruber can you provide some case to reproduce this on another enviroment?

@adamgruber
Copy link
Author

@helderburato Why was this closed without explanation? It's only been 2 days since the request for repro. I plan to add one but even still I feel like the original question was never answered.

@adamgruber
Copy link
Author

Here's a repo project that illustrates this issue: https://github.com/adamgruber/clipboard-js-issue. I stand by my original statement that this was a breaking change.

@patrickhlauke
Copy link
Contributor

Why was this closed? it's an actual issue still...

@patrickhlauke
Copy link
Contributor

copying in what I wrote over in twbs/bootstrap#33894

setting keyboard focus on one of the "Copy" buttons and activating it, focus is then lost/reset to the start of the page. While browsers try to error-correct for this (meaning that a subsequent Tab moves to the next focusable element), the issue becomes evident when using AT (e.g. Chrome/JAWS, activate the button, then use reading keys to carry on reading...focus was moved back right to the start of the page).

Ideally, focus should remain on the "Copy" button, but I'm assuming this was not done in order to "clear" the visual style of the button. Perhaps this needs to dynamically set a class immediately after a copy operation was carried out, which suppresses/changes the styling (maybe suppressing the tooltip, OR adding some indicator like a tick that shows it was indeed copied), and clearing that class again as soon as the button loses focus.

Note that this behaviour now reverts what was fixed originally in #419

@patrickhlauke
Copy link
Contributor

@zenorocha could this be reopened please?

@patrickhlauke
Copy link
Contributor

Note that this has now been fixed/merged #807

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

No branches or pull requests

4 participants