-
Notifications
You must be signed in to change notification settings - Fork 739
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 top navigation positioning when window is resized #13007
base: develop
Are you sure you want to change the base?
Fix top navigation positioning when window is resized #13007
Conversation
…sition and implement a window resize event listener to update showTopNavBar based on the breakpoint
…improve responsiveness with screen size and NavBar position changes
Build Artifacts
|
@pcenov this seems relatively straightforward, but if it can go on your to-do list I would appreciate the QA team review! thank you (cc @radinamatic) |
@@ -222,9 +224,18 @@ | |||
window.addEventListener('click', this.handleWindowClick); | |||
window.addEventListener('keydown', this.handlePopoverByKeyboard, true); |
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.
Probably out of scope for this fix, but might be worth using the opportunity to move the event additions to the mounted hook instead? Unless there are strong opinions one why it was done that way :)
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 am not against moving these event listeners to the mounted hook instead, I will update the PR with this change.
@@ -222,9 +224,18 @@ | |||
window.addEventListener('click', this.handleWindowClick); | |||
window.addEventListener('keydown', this.handlePopoverByKeyboard, true); | |||
}, | |||
beforeUpdate() { | |||
// Essential for title updates after data finishes loading | |||
this.breakpointLimit = this.title && this.title.length >= 20 ? 4 : 3; |
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.
Is the title length we are checking against arbitrary?
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.
This comparison to the title length is important for determining the lowest breakpointLimit
, which is initially set to be 4. However, with a title length that is 20 characters or less, the NavBar
can be positioned at the bottom when the windowBreakpoint
is 3, without the overflow menu button being displayed. With longer titles, the breakpointLimit
should continue to be 4.
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.
Ahh I see, thanks. For purposes of clarity, I think it would be great to add a comment( or use descriptive variable or both? whichever makes more sense) describing that the value 20
is what is currently specified as the maximum title length on small windows. Otherwise, this could end up being a potential source of bugs, considering that any change here would also require a change in the AppBar.js
where this value is specified.
:text="windowIsSmall ? truncateText(title, 20) : truncateText(title, 50)" |
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.
Hi @LianaHarris360! Changes look good and make sense to me! The only question I have is around how we arrive to the title length we used to determine the breakpoint limit. Beyond that, we should be good to go after manual QA.
…ble indicating that 20 is the max title length for small screens
…avbar positioning
@marcellamaki observed that switching the language to Fulfulde resulted in longer navigation link text in the Coach plugin, which triggered the overflow menu button even though the navbar was positioned at the top of the AppBar. The navbar position is now determined by the navbarPosition.mov |
Summary
This pull request adjusts the positioning of the
NavBar
withinAppBar.vue
so that the tabs in the navigation move to the second line when the page shrinks and there isn't enough space. Only after that, on smaller screen sizes, is the overflow menu dropdown button displayed.This issue is most apparent in the Coach plugin when the classroom title is very long, however this change does impact other Kolibri plugins.
To prevent the overflow menu dropdown button from appearing when the navigation is at the top position, the top NavBar is hidden and the bottom NavBar is displayed if the
breakpointLimit
is less than thewindowBreakpoint
during window resizing. Alternatively, if thebreakpointLimit
is greater than thewindowBreakpoint
, the top NavBar is shown and the bottom NavBar is hidden.Based on the length of the title property, the
breakpointLimit
is either 4 or 3. For example, if the page title is longer than 20 characters, the top NavBar will be shown until thewindowBreakpoint
equals 4.A window resize event listener has also been added to
AppBarPage
to updateappBarHeight
and improve page responsiveness when the screen size and NavBar position changes, replacing the use ofwindowBreakpoint
within AppBarPage.Before:
384394615-d324f647-e98b-4ed3-9397-85248fec9568.mp4
After:
WindowResizing.mov
References
Fixes #12813
Reviewer guidance