Skip to content

Commit

Permalink
Remove scrim's ability to cancel closes
Browse files Browse the repository at this point in the history
We want to add animations, and the cancel logic makes this
unnecessarily complex. It's not currently being used and we have
better alternatives that are less disruptive for users.
  • Loading branch information
sfnelson committed Oct 10, 2023
1 parent 4cf9673 commit a4b1baa
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions app/assets/javascripts/controllers/scrim_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,11 @@ export default class ScrimController extends Controller {
this.openValue = true;

// notify listeners of pending request
const event = this.dispatch("show", { bubbles: true, cancelable: true });

// if notification was cancelled, update request and abort
if (event.defaultPrevented) {
this.openValue = false;
request.preventDefault();
return;
}
this.dispatch("show", { bubbles: true });

if (DEBUG) console.debug("show scrim");

// perform show updates
// update state, perform style updates
this.#show(request.detail);
}

Expand All @@ -87,14 +80,7 @@ export default class ScrimController extends Controller {
this.openValue = false;

// notify listeners of pending request
const event = this.dispatch("hide", { bubbles: true, cancelable: true });

// if notification was cancelled, update request and abort
if (event.defaultPrevented) {
this.openValue = true;
request.preventDefault();
return;
}
this.dispatch("hide", { bubbles: true });

if (DEBUG) console.debug("hide scrim");

Expand All @@ -111,10 +97,6 @@ export default class ScrimController extends Controller {
this.hide(event);
}

disconnect() {
super.disconnect();
}

/**
* Clips body to viewport size and sets the z-index
*/
Expand Down

0 comments on commit a4b1baa

Please sign in to comment.