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

Navbar UI Link Color and Functionality Updates #5178

Merged
merged 17 commits into from Feb 5, 2024

Conversation

DistantVoyager
Copy link
Contributor

@DistantVoyager DistantVoyager commented Jan 26, 2024

Closes #5177

What's Changed

  • Added Navbar dropdown arrow rotation on open/close.
  • Removed unneeded tooltip of dropdown title.
  • Navbar dropdown links turn orange on hover and when active/clicked; state is saved.
  • Removed navbar dropdown links underlining.
  • Changed navbar state save to use session storage.
  • Added reset navbar state when home link is clicked.

Screenshots

Before:

image

image

image

image

After:

image

image

image

image

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example

@DistantVoyager DistantVoyager self-assigned this Jan 26, 2024
@DistantVoyager DistantVoyager linked an issue Jan 26, 2024 that may be closed by this pull request
12 tasks
@DistantVoyager
Copy link
Contributor Author

Re: https://github.com/nautobot/nautobot/pull/5146/files/adfe3db6b0e99b3e230ff6b87e600bf13cf39398#r1464770401,

@bradh11 - take a look at this PR and see if you think it would improve your saved navbar state feature from #5146

This uses sessionStorage instead of localStorage which will clear if the tab closes (e.g. a user closes the tab, opens their Nautobot home bookmark later in the day -> the navbar will be reset instead of restoring the state from the previous session).

I also added a reset navbar function that clears the storage when someone goes back to the home page, restoring the navbar back to the original state.

@bradh11
Copy link
Contributor

bradh11 commented Jan 27, 2024

I like the updates on the dropdown arrow and likewise to the reset on clicking home. That was something I had thought about after #5146 merged. Nice to see you put that in here!

On the topic of session storage vs local storage for state mgmt -> I had considered that implementation but was thinking the likelihood of closing the page and coming back and expecting the dropdowns and scroll position to be exactly where you left off would be pretty low. I don't think it would be negative for that behavior to occur, but I also don't think it would be expected by the user.

That being stated - I believe more permanent storage for state might really shine with regards to the home page panels. @matt852 and I were discussing this just yesterday. I think a case could be made to even have a db table tracking that.

@bradh11
Copy link
Contributor

bradh11 commented Jan 27, 2024

Also, keep an eye on #5172 as it is introducing collapse capable sidebar. There may be some potential merge conflicts so we should coordinate updates accordingly.

@bradh11
Copy link
Contributor

bradh11 commented Jan 27, 2024

@DistantVoyager , what do you think about having the menu dropdown caret arrrows point left by default and down when expanded? It might “feel” more natural in that it will give the appearance of “unfurling” the menu.

@DistantVoyager
Copy link
Contributor Author

...
On the topic of session storage vs local storage for state mgmt -> I had considered that implementation but was thinking the likelihood of closing the page and coming back and expecting the dropdowns and scroll position to be exactly where you left off would be pretty low. I don't think it would be negative for that behavior to occur, but I also don't think it would be expected by the user.
...

@bradh11 With localStorage as it's implemented currently, that behavior is what's happening. Currently, if a user closes the tab or window and then comes back later, the navbar state is restored (which I agree is not ideal).

Example with localStorage:

image

User closes the Nautobot tab or window. User then goes to Nautobot at some later point, but the navbar state is unexpectedly restored/kept from prior visit:

image

The change from localStorage to sessionStorage in this PR will fix that. localStorage persists across browser sessions and is not cleared unless the user explicitly clears browser data or the code removes it. But sessionStorage is specific only to the current session and gets cleared when the user closes the browser or the tab. Thus when they return, the navbar is back to normal.

Example with sessionStorage:

image

User closes the Nautobot tab or window. User then goes to Nautobot at some later point, and the navbar state is normal, as expected:

image

Let me know if that makes sense!

@bradh11
Copy link
Contributor

bradh11 commented Jan 29, 2024

...
On the topic of session storage vs local storage for state mgmt -> I had considered that implementation but was thinking the likelihood of closing the page and coming back and expecting the dropdowns and scroll position to be exactly where you left off would be pretty low. I don't think it would be negative for that behavior to occur, but I also don't think it would be expected by the user.
...

@bradh11 With localStorage as it's implemented currently, that behavior is what's happening. Currently, if a user closes the tab or window and then comes back later, the navbar state is restored (which I agree is not ideal).

Example with localStorage:

image

User closes the Nautobot tab or window. User then goes to Nautobot at some later point, but the navbar state is unexpectedly restored/kept from prior visit:

image

The change from localStorage to sessionStorage in this PR will fix that. localStorage persists across browser sessions and is not cleared unless the user explicitly clears browser data or the code removes it. But sessionStorage is specific only to the current session and gets cleared when the user closes the browser or the tab. Thus when they return, the navbar is back to normal.

Example with sessionStorage:

image

User closes the Nautobot tab or window. User then goes to Nautobot at some later point, and the navbar state is normal, as expected:

image

Let me know if that makes sense!

Yes. Makes much more sense now. Fully support this approach and change. I thought it was the opposite scenario - thanks for taking the time to explain.

@DistantVoyager
Copy link
Contributor Author

@DistantVoyager , what do you think about having the menu dropdown caret arrrows point left by default and down when expanded? It might “feel” more natural in that it will give the appearance of “unfurling” the menu.

@bradh11 - how about this?

Before:

image

image

After:

image

image

I don't really have a preference one way or the other. I've seen both caret types for dropdown elements.

Not sure I'd have them point left, as I feel it looks a bit odd:

image

@matt852
Copy link
Contributor

matt852 commented Jan 29, 2024

I like the point right for collapsed, point down for expanded options. This is looking really nice btw!

@bradh11
Copy link
Contributor

bradh11 commented Jan 29, 2024

I like the point right for collapsed, point down for expanded options. This is looking really nice btw!

This is my preference as well after seeing screenshots. Looking good. 👍

@DistantVoyager DistantVoyager marked this pull request as ready for review January 30, 2024 15:09
@DistantVoyager DistantVoyager requested review from a team and removed request for a team January 30, 2024 15:10
changes/5178.added Outdated Show resolved Hide resolved
changes/5178.changed Outdated Show resolved Hide resolved
nautobot/core/templates/inc/nav_menu.html Show resolved Hide resolved
DistantVoyager and others added 2 commits January 31, 2024 10:36
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
// Add click event listeners to dropdown links
addLinkClickListeners();

// Apply the 'active' class to the previously clicked link
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be updated to only set the clicked link to active if it was previously closed? Currently when you close a dropdown the link remains orange until you click on something else.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@gsnider2195
Copy link
Contributor

Got some feedback from @lampwins on this today.

  • Can you try to make the arrows on the top level menu items look more like cloud?
    • Hover them all to the right so they're vertically aligned
    • Closed is an up pointing arrow and open is a down pointing arrow. You may be able to use a caret icon for this.

image

Cloud menu open:

image

Cloud menu closed:

image

  • Can you change the sub menu items back to the previous behavior from demo.nautobot.com? We want to tweak that to make it work better with the buttons and make it look more like cloud but that can be done as a separate item
.navbar-fixed-left .navbar-nav > .dropdown > .nav-dropdown-menu > li > a:hover {
    transition: background-color 200ms ease;
    background-color: #cdf3ff1a
}

@DistantVoyager
Copy link
Contributor Author

Got some feedback from @lampwins on this today.

  • Can you try to make the arrows on the top level menu items look more like cloud?

    • Hover them all to the right so they're vertically aligned
    • Closed is an up pointing arrow and open is a down pointing arrow. You may be able to use a caret icon for this.

image

Cloud menu open:

image

Cloud menu closed:

image

  • Can you change the sub menu items back to the previous behavior from demo.nautobot.com? We want to tweak that to make it work better with the buttons and make it look more like cloud but that can be done as a separate item
.navbar-fixed-left .navbar-nav > .dropdown > .nav-dropdown-menu > li > a:hover {
    transition: background-color 200ms ease;
    background-color: #cdf3ff1a
}

Updated - I changed the dropdown icon and the link style on hover and click to match that of Nautobot Cloud.

image

image

@gsnider2195
Copy link
Contributor

Got some feedback from @lampwins on this today.

  • Can you try to make the arrows on the top level menu items look more like cloud?

    • Hover them all to the right so they're vertically aligned
    • Closed is an up pointing arrow and open is a down pointing arrow. You may be able to use a caret icon for this.

image
Cloud menu open:
image
Cloud menu closed:
image

  • Can you change the sub menu items back to the previous behavior from demo.nautobot.com? We want to tweak that to make it work better with the buttons and make it look more like cloud but that can be done as a separate item
.navbar-fixed-left .navbar-nav > .dropdown > .nav-dropdown-menu > li > a:hover {
    transition: background-color 200ms ease;
    background-color: #cdf3ff1a
}

Updated - I changed the dropdown icon and the link style on hover and click to match that of Nautobot Cloud.

image

image

This looks awesome! Thanks @DistantVoyager

@glennmatthews glennmatthews merged commit 0c48b2f into develop Feb 5, 2024
17 checks passed
@glennmatthews glennmatthews deleted the steven-ui-updates branch February 5, 2024 21:03
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.

Navbar Colors and Functionality
5 participants