material-components / material-components-web-catalog

Catalog of Material Components for the web (MDC Web)
https://material-components.github.io/material-components-web-catalog/
Apache License 2.0
116 stars 42 forks source link

Enhanced Select Dropdown alignment is off #266

Closed abhiomkar closed 4 years ago

abhiomkar commented 5 years ago

Version

v0.44.1

Actual

image

Expected

image

Dropdown is aligned as expected when opened second time.

acdvorak commented 5 years ago

This issue only seems to happen the first time the menu is opened on the initial load of the Catalog page.

The second time the menu is opened, it is positioned correctly. Reloading the page also causes the menu to be positioned properly on first open.

The only way to repro the misalignment is to open a new browser tab, navigate to the Catalog page, and interact with an Enhanced Select:

screen video capture

AFAICT, this issue is not present on any of our screenshot test pages.

It might be a bug in the Catalog site (something something caching?).

cintaccs commented 5 years ago

could it be the body scroll bars that in some cases are adding to the "left" and in some cases not (like in your test case pages)...

moog16 commented 5 years ago

I'm actually not able to reproduce this issue in an isolated setting, or in the screenshot tests. I think its just our catalog pages. I'm going to transfer this issue to the catalog.

This is what I used to try to reproduce:

<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css">

  <body>
    <div class="mdc-select" id='select'>
      <input type="hidden" name="enhanced-select">
      <i class="mdc-select__dropdown-icon"></i>
      <div class="mdc-select__selected-text"></div>
      <div class="mdc-select__menu mdc-menu mdc-menu-surface">
        <ul class="mdc-list">
          <li class="mdc-list-item mdc-list-item--selected" data-value="" aria-selected="true"></li>
          <li class="mdc-list-item" data-value="grains">
            Bread, Cereal, Rice, and Pasta
          </li>
          <li class="mdc-list-item" data-value="vegetables">
            Vegetables
          </li>
          <li class="mdc-list-item" data-value="fruit">
            Fruit
          </li>
        </ul>
      </div>
      <span class="mdc-floating-label">Pick a Food Group</span>
      <div class="mdc-line-ripple"></div>
    </div>
    <script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>

    <script>
      mdc.select.MDCSelect.attachTo(document.getElementById('select'));
    </script>
  </body>
</html>
bonniezhou commented 4 years ago

Fixed!