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

[web] Sidebar improvements #462

Merged
merged 24 commits into from
Mar 14, 2023
Merged

[web] Sidebar improvements #462

merged 24 commits into from
Mar 14, 2023

Conversation

dgdavid
Copy link
Contributor

@dgdavid dgdavid commented Mar 11, 2023

Originally created for the iSCSI UI #435, this set of changes had the sole purpose of allowing us to teleport links from a page to a layout slot created for this use case. However, a few other changes were either necessary for the implementation of the feature or deemed important enough for the next release. Namely

  • Taken advantage of the event bubbling for auto-closing the sidebar when an action is clicked instead of passing the "closeCallback" around.

  • Dropped the TargetIpsPopup action and component since they became a bit useless now we have the addresses summary in the network section at Overview page.

  • Adapted the action for navigating to the product selection page:

    • Use a link instead of a button, since it's an element that lets the user navigate

    • It's displayed only on the Overview page

    • Has been moved to the software namespace

  • Started using the dark green (aka Pine Green) as the primary color due to the low contrast of the lighter one (aka Jungle Green), which has been relegated to the :hover states (still having the same low contrast, though)

  • Kept betting on plain old HTML links. I.e., use the "default" underlined text for actions in the sidebar too (even though some of the actions there are actually buttons, but visually it is accepted to present them as links)

  • Use a custom disclosure widget for grouping some actions, like the "Diagnostic tools" ones.

  • Changed the test-suite a bit to use a MemoryRouter and improve how navigation is mocked. That was a change due to 0560498, which was later "reverted". Still, changes in test remain because it's cleaner now to deal with routes (see lines dropped at 0413912)

And maybe some other small stuff not summarized above.

Before After (with diagnostic tools collapsed) After (with diagnostic tools expanded)
Screen Shot 2023-03-13 at 15 11 42-fullpage Screen Shot 2023-03-13 at 15 33 33-fullpage Screen Shot 2023-03-13 at 15 33 29-fullpage

Note: after latest changes, after screenshots are a bit out-dated. Now the link is "Change product" instead of "Change selected product"

@coveralls
Copy link

coveralls commented Mar 11, 2023

Coverage Status

Coverage: 79.96% (+0.02%) from 79.937% when pulling 205d649 on sidebar-improvements into 4ca7abc on master.

dgdavid added 2 commits March 13, 2023 08:53
Taking advantage of event bubbling[1] eliminates the need to pass a callback
for every action rendered in the sidebar. Rather, the sidebar will close itself
unless after clicking an action unless the it has the
`data-keep-sidebar-open="true"` attribute.

[1] https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#event_bubbling
Because it's useless from the testing point of view.
@dgdavid dgdavid force-pushed the sidebar-improvements branch 2 times, most recently from cf491db to 7260dfb Compare March 13, 2023 11:15
dgdavid added 18 commits March 13, 2023 14:23
Because from the accessibility point of view link is the right element when
navigating to somewhere. Buttons must be used for triggering actions that does
not change browser focus or page location.

See https://www.w3.org/TR/wai-aria-1.2/#link
By not displaying it when already in the product selection path.
This is yet another intermediate (and probably temporary) step toward defining
the look & feel. Take it lightly. There is a lot of work to be done in that
regard, but it will have to wait a while.
And start using it for grouping the Diagnostic tools in the Sidebar.
It's a combination of a teleported Layout slot and a component for allowing
pages to put their relevant or related actions at the top of the Sidebar.
By closing it only if the click comes from an HTMLButtonElement or
HTMLAnchorElement. Also, adapt it to look for the original target first to
cover cases where we redispatched events using CustomEvents from Portals.
Now that pages can put their relevant actions at the top of the Sidebar, makes
sense that the Overview page place the "Change selected product" there.
Now that the Network section summarizes the available connections, this
component is not that relevant. It is being dropped to reduce the confusion of
having two slightly different network summaries in two different locations.
The logic for not rendering it when already on the product selection page is no
longer needed now that it's rendered on demand (when the user is on the
Overview page at this moment).
That way, the use of React.useMemo to avoid re-rendering them in each
visibility change is not longer needed. It simplifies things a lot.
@dgdavid dgdavid force-pushed the sidebar-improvements branch from 091cf20 to 99df6db Compare March 13, 2023 14:23
@dgdavid dgdavid marked this pull request as ready for review March 13, 2023 14:57
dgdavid added 2 commits March 13, 2023 15:29
By adding the product name to know in advance about what the information will
be about.
@dgdavid dgdavid requested a review from imobachgs March 13, 2023 15:35
Copy link
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

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

Awesome work! Just some tiny comments. Once they are addressed, you can merge.

web/package/cockpit-d-installer.changes Outdated Show resolved Hide resolved
web/src/components/core/PageOptions.jsx Outdated Show resolved Hide resolved
web/src/components/software/ChangeProductLink.jsx Outdated Show resolved Hide resolved
@dgdavid dgdavid merged commit aaa58ee into master Mar 14, 2023
@dgdavid dgdavid deleted the sidebar-improvements branch March 14, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants