material-components / material-components-web

Modular and customizable Material Design UI components for the web
https://material.io/develop/web
MIT License
17.14k stars 2.15k forks source link

[Top App Bar] scrolling bug #6589

Open youra-h opened 3 years ago

youra-h commented 3 years ago

Bug report

Steps to reproduce

  1. Go to Top appbar Standart 1.1 Disable height .top-app-bar__frame
  2. Shrink the window to show the scroll bar
  3. Scroll down
  4. The top app bar is gone. ok!
  5. Enlarge the window so that the scroll bar disappears. The top app bar remained unchanged.This is bug.

I am using code like this, at the moment:

window.addEventListener('scroll', () => {
    var element = document.querySelector('body');
    var position = element.getBoundingClientRect();

    // checking whether fully visible
    if(position.top >= 0 && position.bottom <= window.innerHeight) {
        $(topAppBarbar.root).animate({top:0}, 'fast');
        or
        topAppBar.root.style.top = "0";
    }
});

Actual behavior

Expected behavior

Screenshots

Your Environment:

Software Version(s)
MDC Web 8.0.0
Browser Chrome/Opera
Operating System Windows 10

Additional context

Possible solution

joyzhong commented 3 years ago

Can you provide the actual versus expected behavior, along with screenshots and a Glitch/Codepen demo?

youra-h commented 3 years ago

Codeopen

  1. In the Result window, scroll down to the end
  2. Enlarge the result window so the scroll bar disappears

Step 1 image

Step 2 image

Step 3 image

joyzhong commented 3 years ago

Thanks for the Codepen and repro steps! This does seem like a bug, adding to our backlog.

simonziegler commented 3 years ago

Hi - is there any further update on this? I notice this still happens with version 12. If you make a window small and scroll down, followed by enlarging the window to remove the scrollbar, you will lose the top app bar.

simonziegler commented 2 years ago

Hi - is there any update on this bug?