question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NavDropdown alignRight does not allow for breakpoints

See original GitHub issue

Describe the bug

I’d like to be able to constrain the alignRight property of NavDropdown’s based on breakpoint, much the same way you can do this with other bootstrap properties (e.g. dropdown-menu-{breakpoint}-right classes).

Related to #4994 and #3310?

To Reproduce

Open https://codesandbox.io/s/naughty-ellis-w4zo1 and play with the drop-down at different page widths.

Notice that when the page is narrow and the Toggle element moves to the left, the alignRight property no longer makes sense.

Expected behavior

Applying something like className="dropdown-menu-sm-right" works with regular Dropdown components, but does not appear to be possible with NavDropdown’s. I tried alignRight="sm", but that doesn’t do anything (other than spit lint errors.)

Screenshots

When the screen is wide, the alignRight makes sense … image

But when the screen is narrow, and the dropdown button moves to the left, the dropdown is in the wrong spot… image

Environment (please complete the following information)

$ npx envinfo --system --browsers --npmPackages --binaries
npx: installed 1 in 0.859s

  System:
    OS: macOS 11.1
    CPU: (8) x64 Apple M1
    Memory: 29.52 MB / 16.00 GB
    Shell: 5.1.0 - /usr/local/bin/bash
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Chrome: 90.0.4430.93
    Firefox: 88.0
    Safari: 14.0.2
  npmPackages:
    @parcel/babel-plugin-transform-runtime: 2.0.0-nightly.1823 => 2.0.0-nightly.1823
    @types/react-dom: 17.0.3 => 17.0.3
    @types/react-router-dom: 5.1.7 => 5.1.7
    @typescript-eslint/eslint-plugin: 4.20.0 => 4.20.0
    @typescript-eslint/parser: 4.20.0 => 4.20.0
    bootstrap: 4.6.0 => 4.6.0
    eslint: 7.21.0 => 7.21.0
    eslint-config-standard: 16.0.2 => 16.0.2
    eslint-plugin-import: 2.22.1 => 2.22.1
    eslint-plugin-node: 11.1.0 => 11.1.0
    eslint-plugin-promise: 4.3.1 => 4.3.1
    eslint-plugin-react: 7.22.0 => 7.22.0
    fast-levenshtein: 3.0.0 => 3.0.0
    firebase: 8.4.2 => 8.4.2
    firebaseui: 4.8.0 => 4.8.0
    nanoid: 3.1.22 => 3.1.22
    parcel: 2.0.0-beta.1 => 2.0.0-beta.1
    react: ^16.13.1 => 16.14.0
    react-bootstrap: 1.5.2 => 1.5.2
    react-dom: ^16.13.1 => 16.14.0
    react-router-dom: 5.2.0 => 5.2.0
    sass: 1.32.12 => 1.32.12
    typescript: 4.2.3 => 4.2.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
broofacommented, May 18, 2021

Just tested this and it looks like it’s working. Thank you!

breadcrumb for anyone who might follow: Installing the latest alpha (above) and adding align={{ sm: 'end' }} worked like a charm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Bootstrap NavDropdown alignRight not working
I can't manage to align the menu to the right, any help would be appreciated. reactjs · bootstrap-4 · react-bootstrap · Share.
Read more >
Navbar - React-Bootstrap
Overview#. Here's what you need to know before getting started with the Navbar: Use the expand prop to allow for collapsing the Navbar...
Read more >
Navbar · Bootstrap v5.0
Documentation and examples for Bootstrap's powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including ...
Read more >
React Bootstrap Navbar Dropdown Does Not Align - ADocLib
<div class "container"></div> in react bootstrap Link> <NavDropdown ... Drop down menu css align right stuck because I really I don't understand where...
Read more >
[Solved]-React Bootstrap - DropdownButton not working-Reactjs
Coding example for the question React Bootstrap - DropdownButton not ... React Bootstrap NavDropdown alignRight not working · npm Bootstrap not working on ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found