question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stop control buttons from 'remain selected' after being clicked

See original GitHub issue

Problem 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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
toniocommented, Oct 4, 2019

I agree with @frasersab that control buttons should not remain displayed focused after moving the pointer away from them.

It’s the case if you don’t focus it by clicking. If you click it, it’s standard behavior to be focused.

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.

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.

1reaction
ahocevarcommented, Oct 4, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found