Commit ab82692d authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[filesapp] Add global pointer-active handler

If the mouse/pointer/touch device is Pressed, adds a class to the root
HTML element (and remove it when the device is released), to allow you
to write CSS to prevent hover effects on inactive elements:

 html.pointer-active some-clickable-element:not(:active):hover {
   background-color: unset;
 }

Bug: 1062902
Change-Id: I6bafc00b608f69ea35d61a8a9e77f22fb597a56a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2111810Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751889}
parent 28f3150d
......@@ -429,8 +429,16 @@ class FileManagerUI {
cr.ui.contextMenuHandler.setContextMenu(
queryRequiredElement('.drive-welcome.page'), this.fileContextMenu);
// Add handlers.
// Add window resize handler.
document.defaultView.addEventListener('resize', this.relayout.bind(this));
// Add global pointer-active handler.
const rootElement = document.documentElement;
['pointerdown', 'pointerup'].forEach((eventType) => {
document.addEventListener(eventType, (e) => {
rootElement.classList.toggle('pointer-active', /down$/.test(e.type));
}, true);
});
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment