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

Feature/watch visibility #1032

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pooriamo
Copy link

This feature adds or removes the className is-visible based on cells' condition.

@desandro
Copy link
Member

Thanks so much for this contribution. This has been requested several times. I'll be evaluating adding this feature in the next minor release.

@larscmagnusson
Copy link

@desandro, great! And when will that be?

@bakura10
Copy link

@larscmagnusson Could this PR be updated to also properly add/remove the aria-hidden attribute based on the cell visibility?

@bakura10
Copy link

@desandro once this PR is updated to handle the aria-hidden could it be merged? If a given slide with aria-hidden=true contains focusable elements, Lighthouse now returns this as an accessibility issue. A simple fix would be to set aria-hidden elements to visibility: hidden, but the fact that Flickity currently does not handle the aria-hidden attribute correctly prevent us to do that :(

Copy link

@jenswittmann jenswittmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR #1032 works great! Please change the following to flickity.js on line 766 to also support aria-hidden on visible slides for PR #1015 (:

    if (isVisible) {
      cell.element.classList.add('is-visible');
      cell.element.removeAttribute('aria-hidden');
    } else {
      cell.element.classList.remove('is-visible');
      cell.element.setAttribute('aria-hidden', true);
    }

@pooriamo
Copy link
Author

pooriamo commented Nov 2, 2020

@jenswittmann Done


this.cells.forEach(function (cell) {
var cellX = cell.element.getBoundingClientRect().x - viewportX;
var isVisible = (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, isVisible will be false when the is-selected cell is itself wider than the browser window, despite that the cell is obviously visible (being the is-selected cell centered on screen).


this.cells.forEach(function (cell) {
var cellX = cell.element.getBoundingClientRect().x - viewportX;
var isVisible = (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isVisible will not function correctly unless the slider is full width. Anything in-line will not work if the cell is not wider than the viewport offset.

I have added a test to check if the value of cellX === 0 as it is the first element within the viewport if the value of cellX is 0 (More specifically I am checking if cellX > -1 && cellX < 1 due to the fluctuation of cell placement when the carousel stops moving).

This is not an ideal solution as I am getting flashing before a slide comes to rest, but it is solving the issue in my use case.

@danimalweb
Copy link

I would love to see this issue resolved.

@dpw1
Copy link

dpw1 commented Mar 27, 2021

Any updates on this?

@desandro desandro added this to the v3 milestone Jan 20, 2022
@ranuss
Copy link

ranuss commented Feb 22, 2022

Is there any update on this?

@MizuBishi
Copy link

Can we merge this please? Would love to have this issue fixed!

@haase1020
Copy link

What is the status on this issue? We are using Flickity and are getting flagged for accessibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.