Stop control buttons from 'remain selected' after being clicked
See original GitHub issueProblem When you click zoom in/zoom out the button you just clicked remains a darkened colour, until you click away. I would like the buttons to only change colour while you are hovering over them and then go back to normal once you are no longer hovering over them.
Google maps doesn’t do this, and from a user interface perspective it doesn’t make sense.
Solution This is all done in ol.css from lines 162 to 166 I want to get rid of the line ‘.ol-control button:focus’ from the below code so that the same behavior that is applied to hover does not get applied to the focus.
.ol-control button:hover,
.ol-control button:focus {
text-decoration: none;
background-color: rgba(0,60,136,0.7);
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How do I prevent WPF buttons from remaining highlighted ...
The better solution is to set the focus to a different control in your window immediately after the user has clicked on the...
Read more >Disable/Enable Buttons in UserForms - TeachExcel.com
Click the desired button > look to the Properties Window (F4) > change the Enabled property to False to disable the button and...
Read more >When a Click is Not Just a Click | CSS-Tricks
The click event is quite simple and easy to use; you listen for the event and run code when the event is fired....
Read more >How to disable or enable buttons using Javascript and jQuery
Learn how to enable or disable buttons using javascript and jQuery based on whether the input field is filled or empty. If you...
Read more >Use Switch Control to interact with your Mac - Apple Support
You can use a keyboard key, mouse button, trackpad button, joystick, ... you've set the option to keep scanning after a selection is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s the case if you don’t focus it by clicking. If you click it, it’s standard behavior to be focused.
Well, that’s not true. On the simple example, a click on the zoom button make it have focus, meaning they are keyboard triggerable after this. If you force unfocus, you need to re-focus the button before being able to trigger.
If the focus is kept, hiding it is a bad practice.
I agree with @frasersab that control buttons should not remain displayed focused after moving the pointer away from them. The default should be to not focus on a standard map, and only focus when the map container has a
tabindex
attribute, which is needed to enable accessibility options anyway.