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

[bug]: Sidebar useIsMobile doesn't change when slowly #6123

Open
2 tasks done
AuTa opened this issue Dec 19, 2024 · 0 comments
Open
2 tasks done

[bug]: Sidebar useIsMobile doesn't change when slowly #6123

AuTa opened this issue Dec 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AuTa
Copy link

AuTa commented Dec 19, 2024

Describe the bug

When I expand the window slowly, the isMobile doesn't change to false.

Add console.log(window.innerWidth, e.matches) get 767 false, but MOBILE_BREAKPOINT is 768, so setIsMobile is true.

Use event.matches or mql.matches or <=?

I find a questions: html - Media query max-width not working inclusively - Stack Overflow. You can see: https://jsfiddle.net/e0hdyqc9/, the 767 is white.

Maybe with max-width when the number is even, media match includes the number; when the number is odd, media match doesn't include the number.

Affected component/components

Sidebar

How to reproduce

  1. Contract the window
  2. Slowly enlarge the window
  3. isMobile doesn't change

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Windows11, Edge

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant