Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

Dropdown can not work well inside a container 'overflow' #211

Open
matuzalemsteles opened this issue Dec 12, 2017 · 11 comments
Open

Dropdown can not work well inside a container 'overflow' #211

matuzalemsteles opened this issue Dec 12, 2017 · 11 comments
Labels

Comments

@matuzalemsteles
Copy link
Collaborator

The current Dropdown that we have it identifies only the size of the screen to know which position will position itself. In more complex environments such as table, your element uses overflow-y:hidden it can not identify that your view will be overridden. This becomes a problem in order to use it.

screen shot 2017-12-11 at 14 05 11

screen shot 2017-12-11 at 21 11 30

@yuchi
Copy link

yuchi commented Dec 12, 2017

Alloy UI drop downs used to attach the menu directly on the body and using a z-index stack manager to (try to) ensure its visibility.

In metal and ICD there's no concept of portals AFAIK (see React docs about them) and it could prove a little difficult to extract the menu in a different part of the dom.

@yuchi
Copy link

yuchi commented Dec 12, 2017

Also, boostrap-style drop downs (those that just show/hide in place) are terribly easier to implement a11y-wise.

If we go back to portal-style menus we'd also need to obscure the page until the menu is closed.

@carloslancha
Copy link
Collaborator

Hey @matuzalemsteles where do we have the overflow: hidden?

@matuzalemsteles
Copy link
Collaborator Author

Table is used in the class table-responsive for using when viewing in the mobile. @pat270 You can talk more about it.

@carloslancha
Copy link
Collaborator

http://pat270.github.io/lexicon/content/tables/

There it's being used table-responsive-lg or table-responsive-sm, why with those dropdown is not affected? Anyway what @yuchi pointed is true, we need to do it in a way to use dropdown in place (like we're doing right now). Maybe we should avoid this kind of overflow issues...

@pat270
Copy link
Collaborator

pat270 commented Dec 12, 2017

This has been a long standing issue with dropdowns in responsive tables (since BS3). The best way to avoid these kind of overflow issues is not to have dropdowns in tables. You will be able to see the overflow issue on the site if you reduce the table rows to 1 or add more items to make the dropdown really big.

Since removing dropdowns from tables doesn't seem like an option this needs to be handled by whatever dropdown plugin we are using.

@jbalsas
Copy link
Contributor

jbalsas commented Dec 13, 2017

Yup, this is a known issue for dropdowns, and indeed needs to be handled by the dropdown plugin, which, as @yuchi points out, might be tricky in a metal environment :(

@yuchi
Copy link

yuchi commented Dec 13, 2017

This is probably a good time to include portals in metal — iff ICD permits.

I’ve been a huge of fan of them in my react projects. See docs →

@jbalsas
Copy link
Contributor

jbalsas commented Dec 13, 2017

Thanks @yuchi, that's a great suggestion, we'll take a look!

/cc @Robert-Frampton!

@jbalsas
Copy link
Contributor

jbalsas commented Jan 15, 2018

Support for Portals has been implemented and released in Metal.js@2.16.0. There's a guide about Portals in the site that should be a good starting point to implement this, although I think @Robert-Frampton was already working on it for this...

@yuchi
Copy link

yuchi commented Jan 15, 2018

Suggestion: have a look at how material-ui@v1 built it with portals.

Short overview:

  • they have their own wrapper around React Portals.
  • most of the “dropdown” behaviour is driven by the Popover component
  • most of the “overlay” behaviour is driven by the Modal components
  • it has great a11y features by making the backdrop invisible to screen reader users (aria-hidden="true") and non interactive to all users.

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

No branches or pull requests

5 participants