Git Product home page Git Product logo

Comments (3)

liamdebeasi avatar liamdebeasi commented on May 4, 2024 1

Thanks for the additional information. I am able to reproduce this, but this does not appear to be an Ionic bug.

The main issue here is that Swiper calls getComputedStyle on the swiper-container element to query for the direction. This requires that the correct direction is set on that element at the time that code is run.

This code is run after the ancestor's Shadow DOM has been created, but before the slot has been added. In Chrome, this means that swiper-container will not inherit the correct direction until after the slot has been added. Since this code is run before that happens, the code I mentioned above reports that swiper-container has direction: ltr set.

This issue also reproduces with the dum-my component added in your sample. Your original code used ng-content which puts the swiper-container inside of the Shadow DOM. This is different from ion-content which projects swiper-container in a slot instead. By changing ng-content to slot in dum-my the issue will reproduce there as well.


As for why this is the case, it has to do with how CSS inheritance is defined:

For a [DOM] tree with shadows, inheritance operates on the flattened element tree. This means that slotted elements inherit from the slot theyโ€™re assigned to, rather than directly from their light tree parent.

This means that swiper-container should inherit from the slot element inside of ion-content not ion-content itself. Since slot has not been added yet, swiper-container does not have anything to inherit from, so it uses the default value for direction which is ltr.

Here's an example of this problem outside of Ionic: https://codepen.io/liamdebeasi/pen/rNbPKxN?editors=1010 I also checked the color property too to demonstrate that this issue is not specific to the direction property.

I am going to close this, but let me know if you have any questions.

from ionic-framework.

liamdebeasi avatar liamdebeasi commented on May 4, 2024

Does this issue reproduce without Swiper? If it only reproduces with Swiper, then you should file a repo on the Swiper repo instead.

from ionic-framework.

Farbdose avatar Farbdose commented on May 4, 2024

Yes and no, this is swiper specific but it only happens when I put the swiper in ionic.

I suspect it's actually some edge case interaction between ionic and the swiper but I created an issue with them as you asked nolimits4web/swiper#7483

I was a bit hesitant to create a new bug there as I created a feature request asking for this exact thing a few days ago and got closed without any conversation with "we already do this" nolimits4web/swiper#7479

from ionic-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.