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

Changing at-rest z-index for Reorder.Item to "unset" #1367

Merged
merged 3 commits into from Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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