-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
@outside
global event filter
- When using `@outside`, it will behave the same as @document but only trigger the action if the event was triggered from outside the element with the attached action - Closes #656
- Loading branch information
Showing
9 changed files
with
127 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
|
||
export default class extends Controller { | ||
close() { | ||
this.element.removeAttribute("open") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%- include("layout/head") %> | ||
|
||
<strong>Opening outside a details item will close them, clicking inside details will not close that one.</strong> | ||
|
||
<details data-controller="details" data-action="click@outside->details#close"> | ||
<summary>Item 1</summary> | ||
<p>These are the details for item 1 with a <button type="button">button</button> and some additional content.</p> | ||
</details> | ||
|
||
<details data-controller="details" data-action="click@outside->details#close"> | ||
<summary>Item 2</summary> | ||
<p>These are the details for item 2 with a <button type="button">button</button> and some additional content.</p> | ||
</details> | ||
|
||
<details data-controller="details" data-action="click@outside->details#close"> | ||
<summary>Item 3</summary> | ||
<p>These are the details for item 3 with a <button type="button">button</button> and some additional content.</p> | ||
</details> | ||
|
||
<details data-controller="details" data-action="click@outside->details#close"> | ||
<summary>Item 4</summary> | ||
<p>These are the details for item 4 with a <button type="button">button</button> and some additional content.</p> | ||
</details> | ||
|
||
<%- include("layout/tail") %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters