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 init incorrectly determining RTL when inside ion-content #7483

Open
5 of 6 tasks
Farbdose opened this issue Apr 23, 2024 · 4 comments
Open
5 of 6 tasks

Swiper init incorrectly determining RTL when inside ion-content #7483

Farbdose opened this issue Apr 23, 2024 · 4 comments
Labels
t0ggles Linked to the t0ggles task

Comments

@Farbdose
Copy link

Farbdose commented Apr 23, 2024

Check that this is really a bug

  • I confirm

Reproduction link

https://stackblitz.com/edit/angular-ywh4p1-vza2cj?file=src%2Fapp%2Fapp.component.html

Bug description

When placing a swiperjs.com swiper inside an ion-content (and rendering it with a delay) the swiper doesn't recognize the surrounding dir="rtl". Only happens with ion-content.

I'm not sure if this is a swiperjs problem or an ionic problem but ionic asked me to create an issue here too: ionic-team/ionic-framework#29368 (comment)

Expected Behavior

rtl should propagate through ion-content regardless of when the component is rendered.

Actual Behavior

  1. create a div with dir="rtl"
  2. put a swiper inside an ion-content inside the div and render it a few ticks later using ngIf
  3. try swiping
  4. swiper doesn't swipe

See linked stackblitz, first swiper works on clean page load but breaks after stackblitz livereload, second swiper doesn't work at all, 3rd and 4th work.

Swiper version

11

Platform/Target and Browser Versions

macOS Chrom 124

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.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@Farbdose
Copy link
Author

Farbdose commented Apr 23, 2024

Based on what I've seen so far it looks like the swiper init runs before the swiper element itself is fully integrated in the dom making it not recognize the surrounding style rules as it's still floating somewhere in the deep dark shadow dom.

Get Computed Style reports ltr while theoretically inside the div with RTL and only switches to RTL a few ticks later.

I observed this a few days ago and couldn't find the actual init code, which lead to me creating a feature request #7479 which got promptly shut down without asking why I may have asked for something that should be already present - my enthusiasmus to create a pr for this has somewhat diminished since then.

@liamdebeasi
Copy link
Contributor

Wanted to cross post my findings regarding this issue: ionic-team/ionic-framework#29368 (comment)

This was originally reported as an Ionic Framework issue, but the root cause appears to be related to how inheritance works with slotted content.

@nolimits4web
Copy link
Owner

t0ggles-create swiper

Copy link

t0ggles bot commented Apr 24, 2024

Task nolimits4web/SWIPER-94 was created

t0ggles task SWIPER-94

@t0ggles t0ggles bot added the t0ggles Linked to the t0ggles task label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t0ggles Linked to the t0ggles task
Projects
None yet
Development

No branches or pull requests

3 participants