-
Notifications
You must be signed in to change notification settings - Fork 92
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
Improve NcCheckboxRadioSwitch
and use for NcAppSidebarTabs
#3945
Conversation
f75c5fd
to
1e7ba44
Compare
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.
Looks much much better!
@susnux a question: On part 1 "with improvements, should the single-line radio buttons not have more border-radius so they are pill-style? (Like we do for the View switcher in Forms currently.)
I used your and @nimishavijay comment here as a reference for how it should look like: #603 (comment) |
@susnux ah thank you for the explanation! :) I would just say let’s give it a bit more border-radius so that when it’s just one line it ends up being pill-style like all our buttons (and the current switcher style in Forms), as otherwise it will look out of place? The radius should be 22px probably, or |
1e7ba44
to
e6821e8
Compare
|
I think that is to much. |
@jancborchardt @raimund-schluessler Do we want the same styling on the vertical group? Or do we want to keep the previous design for the vertical buttons? I think having a consistent button style looks better, but what do you think?
|
@susnux totally agree with you, consistent style also for vertical buttons is best. :) |
e6821e8
to
bd14f63
Compare
Ok I fixed the outer border, used the radius for both vertical and horizontal button groups and fixed the inner border margin. I think it is now ready to go. It looks like this: vokoscreenNG-2023-04-03_14-56-14.mp4 |
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.
Good stuff, let's go with that! :)
@susnux works nicely now in the docs. I will test it in a real app tomorrow. |
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
bd14f63
to
d932b34
Compare
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.
Looks great now I think! :)
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 well with the Tasks app. The failing test still needs a fix, but I have no idea, why it fails, honestly. Seems the NcCheckboxRadioSwitch
does not emit the onToggle
event in the tests, but it works well in a real app.
expect(liList.length).toEqual(3) | ||
}) | ||
it('emit "update:active" event with the selected tab id when clicking on a tab', () => { | ||
const lastLink = wrapper.find('nav>ul>li:last-of-type>a') | ||
const lastLink = wrapper.find('nav>.checkbox-radio-switch:last-of-type>label') | ||
lastLink.trigger('click') |
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.
Maybe await
ing the trigger fixes the test?
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.
Maybe
await
ing the trigger fixes the test?
No, it does not 🙈
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.
More info: a click on the <label>
in <NcCheckboxRadioSwitch>
triggers a click
on <input>
, but does not trigger a change
event.
Seems to be either jsdom or VTU bug, but all related bug reports are fixed.
continues investigating
Signed-off-by: Grigorii Shartsev <grigorii.shartsev@nextcloud.com>
I added a fix for a test. Feel free to squash the commit. More info (actually not much more): jsdom/jsdom#3143 |
I agree with @marcoambrosini about loosing the border. In the previous design, there was no top and side borders, but a bottom border. It made the tab visually "a tab" and the content belove more "a tab content" related to the tabs. With the new designed, it looks less tabs and more radio a switch to me. And adding a border around the button makes them even more a separated radio switch to me, not related to the content below. How I "feel" it: |
Well, I believe that looking like radio buttons is kind of the idea! :) @ShGKme Adding a border makes sure that:
|
But this element has a different semantics. Radio is for switching a value/selection while tabs are not only switching but also a navigation linked to panels. A layered sections. So the user should see that selected tab is also the selected panel. What about adding only bottom border and remove border radius on the bottom (like web-browser tabs)? |
Why I prefer the current style (borders and all round):
|
@jancborchardt I think we need a design decision here, and someone who feels confident to press "Merge" 😉 |
I agree with the points brought up especially regarding accessibility and grouping. For simplicity, I suggest:
So I’ll merge it to unblock the situation. 🙇 |
I split this into separate commits to make reviewing easier as the PR is quite huge.
The first part adjusts the styling of the checkbox radio switch to be used with for the sidebar tabs (adjust borders and add an icon slot).
Part 1: Improve
NcCheckboxRadioSwitch
stylingBefore
The hover colors are confusing, primary color is applied to multiple elements, the border is only applied to not-selected elements.
vokoscreenNG-2023-03-31_22-40-42.mp4
With improvements (added borders)
The border is applied around the whole group, the hover color is fixed to be primary on the checked element and default hover color otherwise.
vokoscreenNG-2023-03-31_23-07-24.mp4
With improvements
The border is applied around the whole group, the hover color is fixed to be primary on the checked element and default hover color otherwise.
Added rounded borders (last commit) to match the mockup in the linked issue.
vokoscreenNG-2023-04-01_02-40-39.mp4
Part 2: Use
NcCheckboxRadioSwitch
forNcAppSidebarTabs
Outdated initial version:
vokoscreenNG-2023-04-01_03-04-05.mp4