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

Nested dropdowns #35891

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Nested dropdowns #35891

wants to merge 2 commits into from

Conversation

mdo
Copy link
Member

@mdo mdo commented Feb 23, 2022

This is heavily WIP and will need some JS work to make it perfect. Mobile behavior will be crucial IMO and ultimately makes or breaks this entire effort. This PR adds some basic submenu positioning (not with Popper) and displaying via CSS.

Here's how we'd need to do it right:

  • On mobile, submenus are toggled via click. Submenus could either expand inline, or overlapping the previous menu somehow. I swear I saw this on iOS but I cannot find an example now.
  • Keyboard navigation would need to be added via JS. Left and right arrows would need to be able to open and close a submenu.
  • If possible, having a safe zone for the cursor to move from main menu to submenu without any jankiness would be ideal.

Would love to hear from @twbs/js-review and the rest of the team on doing this.

.dropdown > .dropdown-item:hover ~ .dropdown-menu {
position: absolute;
top: 0;
left: calc(100% - .25rem); // stylelint-disable-line function-disallowed-list
Copy link
Contributor

@WinterSilence WinterSilence Mar 11, 2022

Choose a reason for hiding this comment

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

hmm.. why not just use right: 0? but better solution is detect position in js - if menu near right side, then submenu must be displayind at left.

}
}

.dropdown .dropdown-menu:hover,
Copy link
Contributor

@WinterSilence WinterSilence Mar 11, 2022

Choose a reason for hiding this comment

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

what's about other direction classes (.dropup and etc.)?

@j-f1
Copy link

j-f1 commented Mar 11, 2022

Submenus could either expand inline, or overlapping the previous menu somehow. I swear I saw this on iOS but I cannot find an example now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants