-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
[Feature Request] A property for remove focus state on v-btn and other components #8572
Comments
I had posted this in the #sponsors Discord channel where I was also given the link to this issue and it was suggested I post my simple (user-level) solution for this, here. It is:
I've added that to my mainline code just before the There is a simple example CodePen of this working here: https://codepen.io/appurist/pen/mdbOLYj?editors=1010 I like this slightly better than putting Also, and more importantly, I'm not certain of the order and timing of the code handling the click vs the focus events. In theory, a Note, this approach should, in theory, be usable on any element that has an An aside, but somewhat related: this code snippet is derived from the simple example for auto-focus on the Vue website, which looks like:
This adds a global custom directive called I know "blur" resulting in |
@appurist Thank You for for v-blur. Being a novice this was very helpful and opened up a whole new realm of intrigue. |
Okay but this looses the focus in general and not after the click right? |
@jmdos When this component's element is inserted into the DOM, it is installing a new However, the event ( (Sorry, I'd check and give you the specific answer but I'm quite late for bed. Hope this helps!) |
@appurist Thank you for the clarification :) |
Would like to know is this fixed with props I am asking this question because I seem to have this behaviour on IE11 but not with Chrome/Edge. In case it is fixed with |
I don't need this feature at all. Just added to global style
|
You don't have to do all that. Just add this to global style and everything solves. Media query is needed because if not, it will remove hover effects on Desktop view.
|
@yoldar and @TaeyoonKwon : How is that going to help to remove the actual focus? (The issue reported is not one of opacity or CSS styles at all.) |
Whether it is technically focused or not isn't important. As he said, the behavior that button is still focused even after touch event is over is counterintuitive to UX. And it can be solved with simple css. |
@TaeyoonKwon "Whether it is technically focused or not isn't important." That's the entire point of this Issue. That you try to solve a different problem is not relevant here. Again, the issue is not one of styling but focus. Edit to add: I think I am starting to understand this point, given my observations below, where the focus actually remains, but the focus is just not observable without the keyboard. It is important for the next/sequence to remain in place while just not highlighting the button in any way after release. |
However, the problem may be moot as it seems buttons don't seem to hold the focus after mouse click anymore. The buttons do hold the focus if you tab through, but that actually seems like a desirable accessibility/keyboard support behavior; it was really the "holding focus after click" that was disruptive, and that seems to be gone now. I suspect the focus/tabbing work that was done for 2.3.0 has rationalized this behavior to only be relevant for when From my perspective, this issue can be closed, but I am not the original reporter, I just agreed with the request and provided a brute-force workaround, which is not as good as the Vuetify behavior is by default now. @jmdos I'm not sure if this changed or if it's been like this all along but the concept of which element has the focus is in fact retained (even with the |
@appurist : Thanks for your solution. Without it, the following code always leave tooltip active, after dialog is closed `
... |
I found that if you don't use the Note this only works with a Directly related: #7907 |
Problem to solve
v-btn component stays in focus state after a click. You know about it, and every time the core team told about MD2 guidelines. But for users, this behavior is still counterintuitive.
Proposed solution
So I suggest adding a new property that would force the component to give exactly the same behavior as it did in Vuetify 1.5. Buttons and other elements should lose focus state after a click.
The text was updated successfully, but these errors were encountered: