mirror of
https://github.com/material-components/material-web.git
synced 2024-08-17 09:30:27 +03:00
perf(ripple): don't process events in high contrast mode
PiperOrigin-RevId: 591368699
This commit is contained in:
parent
cc8d02c847
commit
839667dcf6
@ -87,6 +87,14 @@ const EVENTS = [
|
||||
*/
|
||||
const TOUCH_DELAY_MS = 150;
|
||||
|
||||
/**
|
||||
* Used to detect if HCM is active. Events do not process during HCM when the
|
||||
* ripple is not displayed.
|
||||
*/
|
||||
const FORCED_COLORS = isServer
|
||||
? null
|
||||
: window.matchMedia('(forced-colors: active)');
|
||||
|
||||
/**
|
||||
* A ripple component.
|
||||
*/
|
||||
@ -438,6 +446,11 @@ export class Ripple extends LitElement implements Attachable {
|
||||
|
||||
/** @private */
|
||||
async handleEvent(event: Event) {
|
||||
if (FORCED_COLORS?.matches) {
|
||||
// Skip event logic since the ripple is `display: none`.
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.type) {
|
||||
case 'click':
|
||||
this.handleClick();
|
||||
|
Loading…
Reference in New Issue
Block a user