-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dynamic tabs registration and a11y in NcAppSidebarTabs with provide/inject #3891
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the approach and I think that we can waive the warning when tabs and non-tabs are mixed. The keyboard navigation needs fixing, but that's an easy fix.
isActive() { | ||
return this.$parent.activeTab === this.id | ||
return this.activeTab === this.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that this doesn't work in the Tasks app. I have no idea why, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShGKme I think it would be a good idea to revert this change for now. We can still use it when we figure out why it's broken currently. For vue3 it works fine, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be a problem with getter is old Vue is used. Updated with classic getter instead of computed
.
It currently does not work in the Tasks app, and I didn't figure out yet why. |
For some reason, the injected |
@ShGKme I pushed a few commits to fix some issues that I found, because I wanted to test the changes with my vue3 branch. If you don't like the changes, feel free to discard them. |
I checked that the approach also works for vue3. A few adjustments are of course necessary, but it works fine for vue3 as well, see #3692. |
@ShGKme Ping 🙂 |
Pong 👀. I'll work on this today. |
98ee351
to
92851bb
Compare
Rebased onto master and rewrote WIP commit |
Finished fix
Fix a11y
See: https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html @raimund-schluessler Don't you know if previous behavior was intended? It wasn't possible to focus tabs navigation with Updated docs with JSDocs for events and default slots and examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works nicely now with Tasks as well!
Shall we squash the commits or merge as is? |
fix: #3461 Signed-off-by: Grigorii Shartsev <[email protected]> Co-authored-by: Raimund Schlüßler <[email protected]>
Signed-off-by: Grigorii Shartsev <[email protected]>
Signed-off-by: Grigorii Shartsev <[email protected]>
I think, we may squash commits between the first I squashed with |
871a53d
to
f1acfcc
Compare
Fixes: #3461
Currently,
NcAppSidebarTabs
gets content passed slot, goes throw all nodes, and detectsNcAppSidebarTab
instances. But it happened once on mounted and does not support tabs update.In this solution:
NcAppSidebarTabs
provides:registerTab
methodunregisterTab
methodactiveTab
property (replacement for$parent
), could be revertedNcAppSidebarTab
register and unregister themself oncreated
andbeforeDestroy
NcAppSidebarTabs
has the tab's data directly from theNcAppSidebarTab
sSorting works the same way it was before. But there is no warnings if a user passes not-tabs as content.
This solution is fully compatible with Vue 3 as it is and Composition API.