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:
parent
d5a5e83993
commit
d9abf871af
@ -38,6 +38,18 @@ export class MainLayout extends React.Component<MainLayoutProps> {
|
||||
(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 = () => {
|
||||
this.isPinned = !this.isPinned;
|
||||
this.isAccessible = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user