1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Toggling .mouse-intent

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-11-05 16:40:03 +03:00
parent d5a5e83993
commit d9abf871af

View File

@ -38,6 +38,18 @@ export class MainLayout extends React.Component<MainLayoutProps> {
(sidebarWidth) => this.storage.merge({ sidebarWidth }) (sidebarWidth) => this.storage.merge({ sidebarWidth })
); );
componentDidMount() {
// Toggling .mouse-intent class if mouse or keyboard using in the dashboard
// This allows to remove focus styling to elements when mouse is used
window.addEventListener("click", (evt) => {
if (!evt.detail) return; // No mouse used (e.g. hitted spacebar on button)
document.body.classList.add("mouse-intent");
})
window.addEventListener("keydown", (evt) => {
document.body.classList.remove("mouse-intent");
})
}
toggleSidebar = () => { toggleSidebar = () => {
this.isPinned = !this.isPinned; this.isPinned = !this.isPinned;
this.isAccessible = false; this.isAccessible = false;