chanced / focus-svelte Goto Github PK
View Code? Open in Web Editor NEWfocus lock for svelte
Home Page: https://www.npmjs.com/package/focus-svelte
License: MIT License
focus lock for svelte
Home Page: https://www.npmjs.com/package/focus-svelte
License: MIT License
Batch reads & writes to the DOM
Hi, thank you for your library!
I noticed a bug: when only an element with use:focus={{ enabled: true, preventScroll: true }}
is created preventScroll option does not work.
The bug may be in lines 498 and 513 in action/focus.ts
file (the value of preventScroll option is not used there).
Thanks in advance!
Hi!
I like your library, it's really useful!
In some cases i need to focus on element without scrolling to it (if element behind screen view).
In native JS it looks like this:
element.focus({
preventScroll: true
});
Can you add this feature to your library?
I think it might look like this:
use:focus={{ enabled: true, preventScroll: true }}
Thanks in advance!
I've tried this package, both in the REPL and on a local project, on Chromium/Firefox on Linux, and in Chrome on macOS. None of them are trapping focus anywhere.
Am I missing something?
When there are multiple thousands of nodes, the performance can get a bit janky. Experiment with WeakMap<HTMLElement, {hidden: string[], shown: string[], tabIndex: number | null, ariaHidden: string | null }>
The solution would still need to acquire all elements in the dom and assign them to the map. the MutationObserver
would need to stay.
This solution would reduce a lot of reads and writes to the DOM.
this would dramatically cut down on the number of writes to the DOM.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.