Skip to content

Commit

Permalink
feat(accordion): fix event prevent default for space scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Leotheluck authored and dpellier committed Jul 29, 2024
1 parent 0cf75b2 commit 199c57c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export class OdsAccordion {
tabIndex={ this.isDisabled ? -1 : 0 }
onClick={ (event) => this.handleClick(event) }
onKeyUp={ (event) => this.handleKeyUp(event) }
onKeyDown={ (event) => event.key === 'Space' && event.preventDefault() }
onKeyDown={ (event) => {
event.key === ' ' && event.preventDefault();
} }
part="accordion"
ref={ (el) => this.detailsElement = el as HTMLDetailsElement }
>
Expand Down
2 changes: 2 additions & 0 deletions packages/ods/src/components/accordion/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</details>

<div style="width: 1px; height: 5000px;"></div>


<style>
ods-text {
Expand Down

0 comments on commit 199c57c

Please sign in to comment.