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

Failure to execute 'querySelector' when custom class contains square brackets #674

Open
thalesagapito opened this issue Sep 29, 2023 · 0 comments

Comments

@thalesagapito
Copy link

thalesagapito commented Sep 29, 2023

Describe the bug
I'm trying to override the default styles using Tailwind CSS's arbitrary value classes, which look like this w-full h-[2rem]. This should simply make an element have width: 100% and height: 2rem, but it actually breaks simplebar when applying it to contentEl.

To Reproduce
Steps to reproduce the behavior:

  1. Supply a class containing square brackets, like this: new SimpleBar(element, { classNames: { contentEl: 'h-[1rem]' }})
  2. Check the console for an error: image

Expected behavior
The class should be applied normally and simplebar shouldn't break.

Reproducible example
https://jsfiddle.net/usfneg90/4/

Additional context
Seems like the classNamesToQuery function should be updated to add backslashes before any square brackets to make sure the query selector call works.

Your environment

Software Version(s)
SimpleBar Vue ^2.3.3
Browser Chrome Version 116.0.5845.187 (Official Build) (arm64)
npm/Yarn pnpm 8.5.1
Operating System Mac OS X Ventura 13.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant