Skip to content
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

Merged
merged 9 commits into from
Apr 19, 2023

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Apr 1, 2023

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 styling

Before

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 for NcAppSidebarTabs

before after
image image

Outdated initial version:

before after
image image
vokoscreenNG-2023-04-01_03-04-05.mp4

@susnux susnux added 3. to review Waiting for reviews design Design, UX, interface and interaction design feature: app-sidebar Related to the app-sidebar component feature: checkbox-radio-switch Related to the checkbox-radio-switch component labels Apr 1, 2023
@susnux susnux force-pushed the feat/nc-pill-menu branch from f75c5fd to 1e7ba44 Compare April 1, 2023 02:27
Copy link
Contributor

@jancborchardt jancborchardt left a 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.)

@susnux
Copy link
Contributor Author

susnux commented Apr 3, 2023

@jancborchardt

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)

@jancborchardt
Copy link
Contributor

@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 calc(var(--default-clickable-area) / 2). Then it should be nicely pill-style for single-line buttons and also work well for higher ones like in the sidebar.

@susnux susnux force-pushed the feat/nc-pill-menu branch from 1e7ba44 to e6821e8 Compare April 3, 2023 11:42
@susnux
Copy link
Contributor Author

susnux commented Apr 3, 2023

@jancborchardt

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?

I changed that, it does now look like this:
pill like buttons

@raimund-schluessler
Copy link
Contributor

@jancborchardt

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?

I changed that, it does now look like this: pill like buttons

I think that is to much. calc(var(--default-clickable-area) / 2) i.e. 22px works better, I think. And the outer element needs a radius 2px larger than the inner one, to account for the border-thickness. Otherwise, there will be gaps at the corners.

@susnux
Copy link
Contributor Author

susnux commented Apr 3, 2023

@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?

both pills keep previous
image image

@jancborchardt
Copy link
Contributor

@susnux totally agree with you, consistent style also for vertical buttons is best. :)

@susnux susnux force-pushed the feat/nc-pill-menu branch from e6821e8 to bd14f63 Compare April 3, 2023 12:53
@susnux
Copy link
Contributor Author

susnux commented Apr 3, 2023

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

Copy link
Contributor

@jancborchardt jancborchardt left a 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! :)

@raimund-schluessler
Copy link
Contributor

@susnux works nicely now in the docs. I will test it in a real app tomorrow.
One of the unit tests still needs a fix, though.

@skjnldsv
Copy link
Contributor

skjnldsv commented Apr 4, 2023

I find it a bit weird to have those pill rounded borders next to each others :)
I didn't thought that much into it, but couldn't we have straight borders when there is another button next to it and leave the rounded pill for the first and last items?
image

I'll let the design team take the decision, it's juste a thought :)

susnux added 6 commits April 5, 2023 18:51
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>
@susnux susnux force-pushed the feat/nc-pill-menu branch from bd14f63 to d932b34 Compare April 5, 2023 16:52
Copy link
Contributor

@jancborchardt jancborchardt left a 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! :)

Copy link
Contributor

@raimund-schluessler raimund-schluessler left a 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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe awaiting the trigger fixes the test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe awaiting the trigger fixes the test?

No, it does not 🙈

Copy link
Contributor

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>
@ShGKme
Copy link
Contributor

ShGKme commented Apr 13, 2023

I added a fix for a test. Feel free to squash the commit.

More info (actually not much more): jsdom/jsdom#3143

https://github.com/jsdom/jsdom/blob/31cfdd4541e0cc83c2be9b105fda41bc188f72cd/lib/jsdom/living/nodes/HTMLInputElement-impl.js#L199-L202

@ShGKme
Copy link
Contributor

ShGKme commented Apr 13, 2023

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:

image

@nimishavijay
Copy link

Well, I believe that looking like radio buttons is kind of the idea! :) @ShGKme

Adding a border makes sure that:

  • The items are visually grouped together
  • It doesn't look too similar to a button, which is usually used to do some action. This component will be used to switch between multiple views
  • The alignment of the item is clear. Without the border, it is difficult to determine where the leftmost item begins, thereby making it look like the item is not aligned neatly with the text above or below it (for example, in Marco's video, it seems like "Search" is not neatly aligned with cat-picture.jpg / last edited 3 weeks ago, and adding a border would help)

@ShGKme
Copy link
Contributor

ShGKme commented Apr 13, 2023

Well, I believe that looking like radio buttons is kind of the idea!

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)?

image

@susnux
Copy link
Contributor Author

susnux commented Apr 17, 2023

Why I prefer the current style (borders and all round):

  • It is consistent with the other styles (we always have rounded elements
  • The border groups belonging elements
  • It makes clear where the element ends, so you know where to click (I think this is an important point regarding accessibility

@raimund-schluessler
Copy link
Contributor

@jancborchardt I think we need a design decision here, and someone who feels confident to press "Merge" 😉

@jancborchardt
Copy link
Contributor

jancborchardt commented Apr 19, 2023

I agree with the points brought up especially regarding accessibility and grouping.

For simplicity, I suggest:

  • We go with this design now and merge it, rounded and border around, as it is much better than what is there now and in line with the rest of our design
  • If we want to adjust its occurrence in the right sidebar navigation (as tabs) to use no border, we can very simply do that.

So I’ll merge it to unblock the situation. 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews design Design, UX, interface and interaction design enhancement New feature or request feature: app-sidebar Related to the app-sidebar component feature: checkbox-radio-switch Related to the checkbox-radio-switch component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidebar tabbed navigation normal / hover / focus / active states.
7 participants