Skip to content

Commit

Permalink
fix(ripple)!: remove ripple directive
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove ripple directives and attach like focus rings (parent, `for` attribute, or with `.attach()`

PiperOrigin-RevId: 535648818
  • Loading branch information
asyncLiz authored and copybara-github committed May 26, 2023
1 parent 7c08efd commit 33daf19
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 87 deletions.
72 changes: 0 additions & 72 deletions ripple/directive.ts

This file was deleted.

10 changes: 0 additions & 10 deletions ripple/lib/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ export class Ripple extends LitElement implements Attachable {
private readonly attachableController =
new AttachableController(this, this.onControlChange.bind(this));

// TODO(b/265337232): Remove once ripple directive is removed. This is used to
// prevent two animations while migrating ripples from the directive to the
// new attachment syntax.
private lastHandledEvent?: Event;

attach(control: HTMLElement) {
this.attachableController.attach(control);
}
Expand Down Expand Up @@ -406,11 +401,6 @@ export class Ripple extends LitElement implements Attachable {

/** @private */
async handleEvent(event: Event) {
if (this.lastHandledEvent === event) {
return;
}

this.lastHandledEvent = event;
switch (event.type) {
case 'click':
this.handleClick();
Expand Down
7 changes: 2 additions & 5 deletions ripple/lib/ripple_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

import {html} from 'lit';
import {customElement} from 'lit/decorators.js';
import {createRef, ref} from 'lit/directives/ref.js';

import {Environment} from '../../testing/environment.js';
import {Harness} from '../../testing/harness.js';
import {ripple} from '../directive.js';

import {Ripple} from './ripple.js';

Expand All @@ -37,10 +35,9 @@ describe('Ripple', () => {
const env = new Environment();

async function setupTest() {
const rippleRef = createRef<TestRipple>();
const root = env.render(html`
<div ${ripple(() => rippleRef.value || null)}>
<test-ripple ${ref(rippleRef)}></test-ripple>
<div>
<test-ripple></test-ripple>
</div>
`);

Expand Down

0 comments on commit 33daf19

Please sign in to comment.