Request for changes to make simplebar work within a shadow dom
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.4k
- Forks
- 527
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
We are developing within a shadow-dom, but simplebar currently doesn't work well inside of shadow doms.
What ends up needing to happen is that the CSS needs to be included twice, once inside the shadow dom, and once in the main page. If you don't include it inside the shadow dom, then the the scroll bar won't be styled at all, and if you don't include it in the main page outside of the shadow dom then the simplebar JS can't access the CSS to do what it needs to do (specific example being scrollbarWidth(), which tries to create a dummy element, and adds a class to it to find the width. Without the CSS this doesn't work and you end up with an extremely wide scrollable area inside the shadow).
For those unfamiliar, you can retrieve the shadow dom of an element with el.getRootNode(), and that will return a the document if you aren't in a shadow as well.
Describe the solution you'd like
Described above
Describe alternatives you've considered
We have tried other scrollbar solutions, but like the fact that this one uses the built in scrolling.
We have also downloaded the files locally and included the css twice, and everything works, but including the CSS twice is something we would prefer not to have to do, and downloading the files ourselves and renaming doesn't make it easy to do updates, so having that naming schema in npm would be best for us.
Additional context
Here is a related issue that someone mentioned a few years ago which is the same issue we are having https://github.com/Grsmto/simplebar/issues/87
I could try taking a stab at creating a PR for this
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported behavior in a shadow DOM and inspect how SimpleBar's CSS and scrollbar sizing logic are accessed; issue #87 provides related context. Done means shadow-DOM usage works without manually including the CSS twice, including correct scrollbar sizing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100