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

swiper should init rtl based on document dir #7479

Closed
4 tasks done
Farbdose opened this issue Apr 19, 2024 · 1 comment
Closed
4 tasks done

swiper should init rtl based on document dir #7479

Farbdose opened this issue Apr 19, 2024 · 1 comment

Comments

@Farbdose
Copy link

Clear and concise description of the problem

When creating a swiper it always assumes direction = "ltr" unless told otherwise either through the usage of the dir property or through calling the changeLanguageDirection function.

Suggested solution

On creation the main init function could check for the overall document direction and set it accordingly. The behavior could be controlled by providing "auto" as dir attribute on the swiper:

if (swiper.dir == "auto") {
    swiper.changeLanguageDirection(document.documentElement.getAttribute("dir"));
}

Alternative

No response

Additional context

Dynamic changes of the language direction can be handled by the developer based on concrete implementation.

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

It already checks document and element direction https://github.com/nolimits4web/swiper/blob/master/src/core/core.mjs#L545

Repository owner locked and limited conversation to collaborators Apr 19, 2024
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