Skip to content

Commit

Permalink
fix(NcAppSidebar): provide a method to focus active tab with auto ret…
Browse files Browse the repository at this point in the history
…urn focus

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Feb 7, 2024
1 parent 4dd1de8 commit 6a9e2fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/components/NcAppSidebar/NcAppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,17 @@ export default {
this.$refs.header.focus()
},
/**
* Focus the active tab
* @public
*/
focusActiveTabContent() {
// If a tab is focused then probably a new trigger element moved the focus to the sidebar
this.preserveElementToReturnFocus()
this.$refs.tabs.focusActiveTabContent()
},
/**
* Emit name change event to parent component
*
Expand Down
4 changes: 2 additions & 2 deletions src/components/NcAppSidebarTab/NcAppSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
:aria-label="isTablistShown() ? undefined : name"
:aria-labelledby="isTablistShown() ? `tab-button-${id}` : undefined"
class="app-sidebar__tab"
tabindex="0"
role="tabpanel"
:tabindex="isTablistShown() ? 0 : -1"
:role="isTablistShown() ? 'tabpanel' : undefined"
@scroll="onScroll">
<h3 class="hidden-visually">
{{ name }}
Expand Down

0 comments on commit 6a9e2fa

Please sign in to comment.