Repository navigation
Account for wrapper gap in Filler and hide clones from screen readers - #14
Open
eastagiletracker wants to merge 1 commit into
Open
eastagiletracker wants to merge 1 commit into
eastagiletracker wants to merge 1 commit into
Conversation
Filler measured each item as offsetWidth plus horizontal margins, so a column-gap on a flex or grid wrapper was left out of itemsWidth. Reeller then translated by less than one full cycle and the loop jumped by (item count x gap) on every restart. The gap is now added per item and exposed as calcData.gap. Clones also get aria-hidden="true" so screen readers announce the content once rather than once per clone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes accounting for the wrapper's
gapinFillerand marking clonesaria-hidden="true"(Fixes #4). We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/991. You can sign in with your GitHub ID to claim ownership of the project.What changed and why
Filler.getCalcData()measures each item asoffsetWidthplus its horizontal margins, so agap/column-gapon a flex or grid wrapper is left out ofitemsWidth.Reelleranimates fromx: -itemsWidthto0, so with a gap the cycle is shorter than the real distance between an item and its clone, and the loop jumps by (item count x gap) on every restart. This is the jitter described in #4. TheclonesOverflow: falsepath has the mirror problem:fullWidthis undercounted, so the start position leaves the last element overflowing the container's right edge.The fix adds a small
getGap()that readscolumn-gapfrom the wrapper only when it is a flex or grid container (on a block wrappergaphas no layout effect, so it stays 0), adds it to each item's measured width, and exposes it ascalcData.gap.Reellersubtracts that one trailing gap in theclonesOverflow: falsestart position so the content ends flush. Layouts without a gap measure exactly as before. Separately,addClones()now setsaria-hidden="true"on each clone, as #4 also asks, so screen readers announce the content once instead of once per clone; originals are untouched. Two files, 16 additions and 2 deletions.Reproduction at current
dev(2e127e2) and verificationThe repo has no test runner, so I verified in headless Chrome against the built UMD bundle (
npm run build, thendist/reeller.min.jsloaded on a page with three 100px items in a 700px container,Filler/Reellercreated withautoUpdate: false). Atdev:With this branch:
Controls that must not move stayed identical before and after: flex with no gap (
itemsWidth=300, 0px jump), inline-block items withmargin: 0 10px(itemsWidth=360), a block wrapper withcolumn-gap: 30px(ignored,itemsWidth=300), andclonesOverflow: falsewith no gap (0px).destroy(true)still removes every clone.actualPeriodis the first clone's left edge minus the first item's left edge, i.e. the distance the loop has to travel to be seamless.npm run lint,npm run prettierandnpm run buildare green before and after.How this was managed
This change was tracked as https://eastagiletracker.com/projects/991/stories/1125571 on a board imported from this repo's issues and pull requests (13 stories), https://eastagiletracker.com/projects/991, and used to manage this work.
If you'd rather not receive contributions like this, reply
no-more-prson this pull request and we won't open any further ones on your repositories.Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com