Skip to content

Commit 89ab290

Browse files
authored
Replace "unset" styles with safer override values (#588)
Resolves #585
1 parent 81c278a commit 89ab290

3 files changed

Lines changed: 28 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Replace `"unset"` styles with safer override values
6+
37
## 4.3.0
48

59
- [583](https://github.com/bvaughn/react-resizable-panels/pull/583): `Group` component now sets default `width`, `height`, and `overflow` styles; (both can be overridden using the `style` property)

lib/components/panel/Panel.test.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@ describe("Panel", () => {
117117

118118
const panel = container.querySelector("[data-panel]") as HTMLElement;
119119

120-
expect(panel.style.minHeight).toBe("unset");
121-
expect(panel.style.maxHeight).toBe("unset");
122-
expect(panel.style.height).toBe("unset");
123-
124-
expect(panel.style.minWidth).toBe("unset");
125-
expect(panel.style.maxWidth).toBe("unset");
126-
expect(panel.style.width).toBe("unset");
127-
128-
expect(panel.style.border).toBe("unset");
129-
expect(panel.style.borderWidth).toBe("unset");
130-
expect(panel.style.padding).toBe("unset");
131-
expect(panel.style.margin).toBe("unset");
120+
expect(panel.style.minHeight).toBe("0");
121+
expect(panel.style.maxHeight).toBe("100%");
122+
expect(panel.style.height).toBe("auto");
123+
124+
expect(panel.style.minWidth).toBe("0");
125+
expect(panel.style.maxWidth).toBe("100%");
126+
expect(panel.style.width).toBe("auto");
127+
128+
expect(panel.style.border).toBe("0px");
129+
expect(panel.style.borderWidth).toBe("0px");
130+
expect(panel.style.padding).toBe("0px");
131+
expect(panel.style.margin).toBe("0px");
132132
});
133133

134134
describe("ARIA attributes", () => {

lib/components/panel/Panel.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,16 @@ export function Panel({
153153
Panel.displayName = "Panel";
154154

155155
const PROHIBITED_CSS_PROPERTIES: CSSProperties = {
156-
minHeight: "unset",
157-
maxHeight: "unset",
158-
height: "unset",
159-
160-
minWidth: "unset",
161-
maxWidth: "unset",
162-
width: "unset",
163-
164-
flex: "unset",
165-
flexBasis: "unset",
166-
flexShrink: "unset",
167-
flexGrow: "unset",
168-
169-
border: "unset",
170-
borderWidth: "unset",
171-
padding: "unset",
172-
margin: "unset"
156+
minHeight: 0,
157+
maxHeight: "100%",
158+
height: "auto",
159+
160+
minWidth: 0,
161+
maxWidth: "100%",
162+
width: "auto",
163+
164+
border: "none",
165+
borderWidth: 0,
166+
padding: 0,
167+
margin: 0
173168
};

0 commit comments

Comments
 (0)