We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc8d02c commit 839667dCopy full SHA for 839667d
ripple/internal/ripple.ts
@@ -87,6 +87,14 @@ const EVENTS = [
87
*/
88
const TOUCH_DELAY_MS = 150;
89
90
+/**
91
+ * Used to detect if HCM is active. Events do not process during HCM when the
92
+ * ripple is not displayed.
93
+ */
94
+const FORCED_COLORS = isServer
95
+ ? null
96
+ : window.matchMedia('(forced-colors: active)');
97
+
98
/**
99
* A ripple component.
100
@@ -438,6 +446,11 @@ export class Ripple extends LitElement implements Attachable {
438
446
439
447
/** @private */
440
448
async handleEvent(event: Event) {
449
+ if (FORCED_COLORS?.matches) {
450
+ // Skip event logic since the ripple is `display: none`.
451
+ return;
452
+ }
453
441
454
switch (event.type) {
442
455
case 'click':
443
456
this.handleClick();
0 commit comments