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

aria attributes added to every page when using SvelteKit #348

Closed
jeffalo opened this issue Feb 2, 2022 · 10 comments · Fixed by #350
Closed

aria attributes added to every page when using SvelteKit #348

jeffalo opened this issue Feb 2, 2022 · 10 comments · Fixed by #350
Assignees
Labels
bug Something isn't working

Comments

@jeffalo
Copy link

jeffalo commented Feb 2, 2022

Firstly, Thank you for making this great package. :)

When using svelte-dnd-action within a SvelteKit app, I'm seeing the aria attributes and alerts get added to every page:

image

(This only occurs in production builds)

This is not ideal, as Google thinks it should be the description of my website instead of the stuff I provide.

I am currently importing the svelte-dnd-action under a component used on 2 pages, however the alerts elements are being added on all pages, regardless of whether I have visited a page using the component.

Is this normal, and is there a way to not have them get added on every page?

@isaacHagoel
Copy link
Owner

isaacHagoel commented Feb 2, 2022 via email

@jeffalo
Copy link
Author

jeffalo commented Feb 2, 2022

If the divs were only added to pages that actually use the dnd action would that be a good enough solution? And if they were removed on destroy?

@isaacHagoel
Copy link
Owner

isaacHagoel commented Feb 2, 2022 via email

@jeffalo
Copy link
Author

jeffalo commented Feb 3, 2022

I'm only importing svelte-dnd-action in one component, that's used on a couple pages.

The hididen accessibility divs are added to the document once any page loads, regardless of what page the user is on.

@isaacHagoel
Copy link
Owner

interesting.
currently it happens in keyboardAction.js (the call to initAria).
It could be modified to a smarter version that only lazy initialises it (if it wasn't already) inside of the dndzone function itself and incremend a counter and have destroy decrement the counter and remove all of the aria elements when the couter hits zero.
would that satisfy your needs?

@jeffalo
Copy link
Author

jeffalo commented Feb 5, 2022

That sounds good to me :)

@isaacHagoel
Copy link
Owner

@jeffalo do you mind giving it a shot with branch 348-clean-up-aria?
Let me know if it fixed the issue for you

@isaacHagoel
Copy link
Owner

@jeffalo ping. did u have a chance to test the latest?

@jeffalo
Copy link
Author

jeffalo commented Feb 22, 2022

Hey, apologies for seeing this just now. After running npm run up svelte-dnd-action everything is working perfectly, locally and in production. Thank you so much.

@isaacHagoel
Copy link
Owner

isaacHagoel commented Feb 22, 2022 via email

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
2 participants