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

Handling missing data-hash #6791

Closed
4 tasks done
elibarzilay opened this issue Jun 28, 2023 · 1 comment
Closed
4 tasks done

Handling missing data-hash #6791

elibarzilay opened this issue Jun 28, 2023 · 1 comment

Comments

@elibarzilay
Copy link

Clear and concise description of the problem

When there are only some slides with a data-hash, getting to one without it will put a #null in the URL. The effect on user interaction is harmless, but for people who'd pay attention to the URL it looks like a bug, and it's also a likely bug on the slideshow author's side.

(This is indirectly related to #6789 -- sorry about the noise there, I somehow messed things up with running into a problem that was probably solved in 69acab4.)

Suggested solution

It would be better if such slides would just drop the #null from the URL, which IIUC, would make the overall interaction the same.

Alternative

Alternatively, it could assign an ordered integer to these slides, or a hash based on the slide contents. This would have the added benefit of making hashNavigation: true work immediately without adding the data attributes to slides.

(It's easy to just add document.querySelectorAll("div.swiper-slide").forEach((d, n) => d.dataset.hash = n + 1);, but why not make it possible to do so automatically...?)

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this feature?

  • I'm willing to open a PR
@nolimits4web
Copy link
Owner

Why do we need to support when it missing, data-hash is a requirement for it work. You can add data hashes on your side with JS

Repository owner locked and limited conversation to collaborators Jul 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants