Skip to content

Commit

Permalink
feat(sidebar): add focusOnClose attribute for sidebar
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Lim <[email protected]>
  • Loading branch information
dianeCdrPix and er-lim committed Feb 4, 2025
1 parent df423c7 commit 94c21a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addon/components/pix-sidebar.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div
class="pix-sidebar__overlay {{unless @showSidebar ' pix-sidebar__overlay--hidden'}}"
{{on "click" this.closeAction}}
{{trap-focus @showSidebar}}
{{trap-focus @showSidebar @focusOnClose}}
{{on-escape-action @onClose}}
>
<div
Expand Down
11 changes: 11 additions & 0 deletions app/stories/pix-sidebar.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ export default {
type: { summary: 'function' },
},
},
focusOnClose: {
name: 'focusOnClose',
description: 'Après fermeture de la Sidebar, ' +
'active ou non le focus sur l‘élément qui a déclenché son ouverture',
type: { name: 'boolean', required: false },
table: {
type: { summary: 'boolean' },
defaultValue: { summary: true },
},
},
},
};

Expand Down Expand Up @@ -71,4 +81,5 @@ Default.args = {
showSidebar: true,
title: 'Filtrer',
onClose: () => {},
focusOnClose: true,
};

0 comments on commit 94c21a4

Please sign in to comment.