Skip to content

Commit

Permalink
Update README documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfelt committed Nov 6, 2024
1 parent 4cf1f51 commit 7cc2c2d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,41 @@ Display an accessible show/hide interface with details and summary elements.

## Description

Show / Hide Section Block provides two blocks: a Show / Hide Group block that is populated with one or more Show / Hide Section blocks.
Show / Hide Section Block provides four blocks that are used to display a group of `<details>` elements that each contain a `<summary>` and an arbitrary number of additional blocks.

* The Show Hide Group block is a wrapping `<div>`.
* The Show Hide Section block is a wrapping `<details>`. One or more of these blocks is added to a Show Hide Group block.
* The Show Hide Summary block contains the content for a `<summary>` tag. One of these blocks is inside each Show Hide Section block.
* The Show Hide Details block contains arbitrary content. One of these blocks is added inside each Show Hide Section block.

The HTML output for an individual section is:

<!-- Each section block has a details element. -->
<details>
<details class="wp-block-happyprime-show-hide-section">
<!-- Each details element has a summary and additional, collapsible content. -->
<summary>Summary text</summary>
<summary class="wp-block-happyprime-show-hide-summary">Summary text</summary>
<!-- Additional inner blocks of any type are populated here. -->
</details>

The HTML output for the group is:

<div>
<details>
<summary></summary>
<div class="wp-block-happyprime-show-hide-group">
<!-- Optional based on attribute -->
<button class="toggle-all" aria-expanded="false">Open all</button>
<details class="wp-block-happyprime-show-hide-section">
<summary class="wp-block-happyprime-show-hide-summary"></summary>
<!-- Additional blocks to be shown/hidden -->
</details>
<details>
<summary></summary>
<details class="wp-block-happyprime-show-hide-section">
<summary class="wp-block-happyprime-show-hide-summary"></summary>
<!-- Additional blocks to be shown hidden -->
</details>
<!-- Additional section blocks -->
</div>

An option is provided in the block's side panel to toggle an "Open all"/"Close all" button. If this is toggled on for a block, an additional `<button>` element will be inserted and JavaScript will be used on the front-end to control the show/hide behavior of all `<details>` elements in the group at once.

If the toggle is off, no JavaScript is loaded on the front end.
If the toggle is off, no JavaScript is loaded on the front end and only the browser's default behavior is used for opening and closing `<details>` elements.

## Changelog

Expand Down
25 changes: 16 additions & 9 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,41 @@ Display an accessible show/hide interface with details and summary elements.

## Description

Show / Hide Section Block provides two blocks: a Show / Hide Group block that is populated with one or more Show / Hide Section blocks.
Show / Hide Section Block provides four blocks that are used to display a group of `<details>` elements that each contain a `<summary>` and an arbitrary number of additional blocks.

* The Show Hide Group block is a wrapping `<div>`.
* The Show Hide Section block is a wrapping `<details>`. One or more of these blocks is added to a Show Hide Group block.
* The Show Hide Summary block contains the content for a `<summary>` tag. One of these blocks is inside each Show Hide Section block.
* The Show Hide Details block contains arbitrary content. One of these blocks is added inside each Show Hide Section block.

The HTML output for an individual section is:

<!-- Each section block has a details element. -->
<details>
<details class="wp-block-happyprime-show-hide-section">
<!-- Each details element has a summary and additional, collapsible content. -->
<summary>Summary text</summary>
<summary class="wp-block-happyprime-show-hide-summary">Summary text</summary>
<!-- Additional inner blocks of any type are populated here. -->
</details>

The HTML output for the group is:

<div>
<details>
<summary></summary>
<div class="wp-block-happyprime-show-hide-group">
<!-- Optional based on attribute -->
<button class="toggle-all" aria-expanded="false">Open all</button>
<details class="wp-block-happyprime-show-hide-section">
<summary class="wp-block-happyprime-show-hide-summary"></summary>
<!-- Additional blocks to be shown/hidden -->
</details>
<details>
<summary></summary>
<details class="wp-block-happyprime-show-hide-section">
<summary class="wp-block-happyprime-show-hide-summary"></summary>
<!-- Additional blocks to be shown hidden -->
</details>
<!-- Additional section blocks -->
</div>

An option is provided in the block's side panel to toggle an "Open all"/"Close all" button. If this is toggled on for a block, an additional `<button>` element will be inserted and JavaScript will be used on the front-end to control the show/hide behavior of all `<details>` elements in the group at once.

If the toggle is off, no JavaScript is loaded on the front end.
If the toggle is off, no JavaScript is loaded on the front end and only the browser's default behavior is used for opening and closing `<details>` elements.

## Changelog

Expand Down

0 comments on commit 7cc2c2d

Please sign in to comment.