Skip to content

Commit

Permalink
Merge pull request #1367 from framer/fix/reorder-z-index
Browse files Browse the repository at this point in the history
Changing at-rest z-index for Reorder.Item to "unset"
  • Loading branch information
mergetron[bot] committed Nov 23, 2021
2 parents 0542616 + 7f02309 commit 806c6ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@ Framer Motion adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Fixing animating to CSS variables with `SVGElement`. [Issue](https://github.com/framer/motion/issues/1334)
- Unsetting `z-index` for resting `Reorder.Item` components. [Issue](https://github.com/framer/motion/issues/1313)

## [5.3.2] 2021-11-23

Expand Down
2 changes: 1 addition & 1 deletion src/components/Reorder/Item.tsx
Expand Up @@ -59,7 +59,7 @@ export function ReorderItem<V>(
}

const zIndex = useTransform([point.x, point.y], ([latestX, latestY]) =>
latestX || latestY ? 1 : 0
latestX || latestY ? 1 : "unset"
)

const layout = useRef<Box | null>(null)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Reorder/__tests__/index.test.tsx
Expand Up @@ -15,7 +15,7 @@ describe("Reorder", () => {
const staticMarkup = renderToStaticMarkup(<Component />)
const string = renderToString(<Component />)

const expectedMarkup = `<article><main style="z-index:0;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></main></article>`
const expectedMarkup = `<article><main style="z-index:unset;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></main></article>`

expect(staticMarkup).toBe(expectedMarkup)
expect(string).toBe(expectedMarkup)
Expand All @@ -34,7 +34,7 @@ describe("Reorder", () => {
const staticMarkup = renderToStaticMarkup(<Component />)
const string = renderToString(<Component />)

const expectedMarkup = `<article><main style="z-index:0;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></main></article>`
const expectedMarkup = `<article><main style="z-index:unset;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></main></article>`

expect(staticMarkup).toBe(expectedMarkup)
expect(string).toBe(expectedMarkup)
Expand Down
8 changes: 5 additions & 3 deletions src/motion/__tests__/ssr.test.tsx
Expand Up @@ -133,7 +133,7 @@ function runTests(render: (components: any) => string) {
const div = render(<Component />)

expect(div).toBe(
`<ul><li style="z-index:0;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></li></ul>`
`<ul><li style="z-index:unset;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></li></ul>`
)
})

Expand All @@ -148,7 +148,9 @@ function runTests(render: (components: any) => string) {
}
const div = render(<Component />)

expect(div).toBe(`<ul><li style="z-index:0;transform:none"></li></ul>`)
expect(div).toBe(
`<ul><li style="z-index:unset;transform:none"></li></ul>`
)
})

test("Reorder: Renders provided element", () => {
Expand All @@ -163,7 +165,7 @@ function runTests(render: (components: any) => string) {
const div = render(<Component />)

expect(div).toBe(
`<div><div style="z-index:0;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></div></div>`
`<div><div style="z-index:unset;transform:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:pan-x" draggable="false"></div></div>`
)
})
}
Expand Down

0 comments on commit 806c6ec

Please sign in to comment.