-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Drawer): ensure ScrollView is used for scrollable content (#1632)
- Loading branch information
1 parent
7ed9550
commit fea2358
Showing
29 changed files
with
216 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
68 changes: 68 additions & 0 deletions
68
packages/dnb-design-system-portal/src/docs/uilib/components/drawer/visual-tests/Examples.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* UI lib Component Example | ||
* | ||
*/ | ||
|
||
import React from 'react' | ||
import ComponentBox from 'dnb-design-system-portal/src/shared/tags/ComponentBox' | ||
|
||
export const DrawerScrollViewSetup = () => ( | ||
<ComponentBox useRender data-visual-test="drawer-scroll-view"> | ||
{ | ||
/* jsx */ ` | ||
const DrawerMock = () => { | ||
const scrollRef = React.useRef() | ||
const innerRef = React.useRef() | ||
const [errorMessage, setErrorMessage] = React.useState(null) | ||
const message = errorMessage | ||
? errorMessage | ||
: 'Yes, the "dnb-scroll-view" is used!' | ||
return ( | ||
<Drawer | ||
contentRef={innerRef} | ||
scrollRef={scrollRef} | ||
onOpen={() => { | ||
const innerOverflowY = window.getComputedStyle( | ||
innerRef.current | ||
).overflowY | ||
const contentElem = scrollRef.current.querySelector( | ||
'.dnb-drawer__content' | ||
) | ||
const contentOverflowY = | ||
window.getComputedStyle(contentElem)?.overflowY | ||
const scxrollOverflowY = window.getComputedStyle( | ||
scrollRef.current | ||
).overflowY | ||
if (contentOverflowY !== 'visible') { | ||
setErrorMessage( | ||
'.dnb-drawer__content was "'+contentOverflowY+'" and not "visible"' | ||
) | ||
} else if (innerOverflowY !== 'visible') { | ||
setErrorMessage( | ||
'.dnb-drawer__inner was "'+innerOverflowY+'" and not "visible"' | ||
) | ||
} else if (scxrollOverflowY !== 'auto') { | ||
setErrorMessage('.dnb-scroll-view was not "auto"') | ||
} | ||
}} | ||
> | ||
<Drawer.Body> | ||
<div style={{ height: '100rem' }}> | ||
<div className="drawer-scroll-view"> | ||
<P size="x-large">{message}</P> | ||
</div> | ||
</div> | ||
</Drawer.Body> | ||
</Drawer> | ||
) | ||
} | ||
render(<DrawerMock />) | ||
` | ||
} | ||
</ComponentBox> | ||
) |
9 changes: 9 additions & 0 deletions
9
...ign-system-portal/src/docs/uilib/components/drawer/visual-tests/hidden-tests.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
draft: true | ||
--- | ||
|
||
import { | ||
DrawerScrollViewSetup, | ||
} from 'Docs/uilib/components/drawer/visual-tests/Examples' | ||
|
||
<DrawerScrollViewSetup /> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Binary file modified
BIN
-5 Bytes
(100%)
...-custom-trigger-screenshot-have-to-match-default-drawer-window-1-61a92.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-15 Bytes
(100%)
...-js-drawer-full-screenshot-have-to-match-default-drawer-window-1-9a1ea.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2 Bytes
(100%)
...imation-spacing-screenshot-have-to-match-default-drawer-window-1-11b99.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.4 KB
...t-js-drawer-screenshot-have-to-match-correct-scroll-view-setup-1-ed515.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4 Bytes
(100%)
...t-js-drawer-screenshot-have-to-match-customized-drawer-trigger-1-93330.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+17 Bytes
(100%)
...test-js-drawer-screenshot-have-to-match-default-drawer-trigger-1-794d3.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-42 Bytes
(100%)
...s-drawer-simple-screenshot-have-to-match-default-drawer-window-1-a61a9.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Oops, something went wrong.