Skip to content

Commit 0b61f8a

Browse files
committed
Fix: Refactor toggle button to prevent focus being lost
1 parent 72ae18e commit 0b61f8a

File tree

1 file changed

+8
-19
lines changed
  • packages/components/src/components/hds/code-block

1 file changed

+8
-19
lines changed

packages/components/src/components/hds/code-block/index.hbs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,14 @@
3232
</div>
3333
{{#if this.showFooter}}
3434
<div class="hds-code-block__overlay-footer">
35-
{{#if this._isExpanded}}
36-
<Hds::Button
37-
class="hds-code-block__height-toggle-button"
38-
@text="Show less"
39-
@color="secondary"
40-
@icon="chevron-up"
41-
@size="small"
42-
{{on "click" this.toggleExpanded}}
43-
/>
44-
{{else}}
45-
<Hds::Button
46-
class="hds-code-block__height-toggle-button"
47-
@text="Show more"
48-
@color="secondary"
49-
@icon="chevron-down"
50-
@size="small"
51-
{{on "click" this.toggleExpanded}}
52-
/>
53-
{{/if}}
35+
<Hds::Button
36+
class="hds-code-block__height-toggle-button"
37+
@text={{if this._isExpanded "Show less" "Show more"}}
38+
@color="secondary"
39+
@icon={{if this._isExpanded "chevron-up" "chevron-down"}}
40+
@size="small"
41+
{{on "click" this.toggleExpanded}}
42+
/>
5443
</div>
5544
{{/if}}
5645
</div>

0 commit comments

Comments
 (0)