This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
[terra-slide-panel] Disclosing node capturing method update #2095
Merged
adoroshk
merged 11 commits into
main
from
slide-panel-return-focus-to-disclosing-node-update
Mar 26, 2024
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dcd9daa
return focus to disclosing node update
adoroshk e56f1f0
set aria-expanded attribute to elements with associated roles only
adoroshk 43981b3
existing jest tests and snapshots updated
adoroshk 9747e56
no main content example and tests added
adoroshk d0e0ace
lint fix
adoroshk dcea4f2
changelog entry for terra-framework-docs added
adoroshk 4b61eb4
removed role check, fixed example
adoroshk 0f70ca8
updated roles in example
adoroshk fb141d7
removed unnecessary test
adoroshk adba09e
Update SlidePanelNoMainContent.test.module.scss
sdadn 91a669c
Update CHANGELOG.md
sdadn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
-96 Bytes
(99%)
...al-lowlight-theme/en/chrome_large/aggregator-spec/close_from_explicit_close.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%)
...rion-fusion-theme/en/chrome_large/aggregator-spec/close_from_explicit_close.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
+10 Bytes
(100%)
...rra-default-theme/en/chrome_large/aggregator-spec/close_from_explicit_close.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
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
102 changes: 102 additions & 0 deletions
102
...terra-framework-docs/src/terra-dev-site/test/slide-panel/SlidePanelNoMainContent.test.jsx
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,102 @@ | ||
import React, { useState } from 'react'; | ||
import SlidePanel, { SlidePanelPositions } from 'terra-slide-panel'; | ||
import classNames from 'classnames/bind'; | ||
import styles from './SlidePanelNoMainContent.test.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
const mainContentForSlidePanel = (togglePanelHandler) => ( | ||
<div> | ||
<header className={cx('header-content')}> | ||
<h3>Main Content</h3> | ||
<button id="mainToggleBtn" type="button" onClick={togglePanelHandler} className={cx('custom-button')}>Toggle Panel 1</button> | ||
{/* eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role */} | ||
<button id="mainToggleBtnWithWrongRole" type="button" role="presentation" onClick={togglePanelHandler} className={cx('extension-button')}>Toggle Panel 2</button> | ||
{ /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions */} | ||
<p id="mainToggleParagraph" onClick={togglePanelHandler} className={cx('extension-button')}>Toggle Panel 3</p> | ||
</header> | ||
<div className={cx('content-wrapper')}> | ||
<p> | ||
This is the main content area of the slide panel. | ||
The overall height of the SlidePanel is determined by | ||
the intrinsic height of the content in this container. | ||
</p> | ||
<p> | ||
{'Focus is moved to the toggle button in the panel container when the panel is opened via the componentDidUpdate lifecycle hook in '} | ||
<a href="https://github.com/cerner/terra-framework/blob/main/packages/terra-slide-panel/src/terra-dev-site/doc/example/DefaultSlidePanel.jsx">the example code</a> | ||
. | ||
</p> | ||
<ul> | ||
<li>Item 1</li> | ||
<li>Item 2</li> | ||
<li>Item 3</li> | ||
<li>Item 4</li> | ||
<li>Item 5</li> | ||
<li>Item 6</li> | ||
<li>Item 7</li> | ||
<li>Item 8</li> | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
|
||
const panelContentForSlidePanel = (togglePanelHandler) => ( | ||
<div> | ||
<header className={cx('header-content')}> | ||
<h3 className={cx('heading')}>Panel Content</h3> | ||
<button id="panelToggleBtn" type="button" onClick={togglePanelHandler} className={cx('extension-button')}>Toggle Panel</button> | ||
</header> | ||
<div className={cx('content-wrapper')}> | ||
<p>This is the panel content area of the slide panel.</p> | ||
<p> | ||
{'Focus is moved to the toggle button in the main container when the panel is closed via the componentDidUpdate lifecycle hook in '} | ||
<a href="https://github.com/cerner/terra-framework/blob/main/packages/terra-slide-panel/src/terra-dev-site/doc/example/DefaultSlidePanel.jsx">the example code</a> | ||
. | ||
</p> | ||
<ul> | ||
<li>Item 1</li> | ||
<li>Item 2</li> | ||
<li>Item 3</li> | ||
<li>Item 4</li> | ||
<li>Item 5</li> | ||
<li>Item 6</li> | ||
<li>Item 7</li> | ||
<li>Item 8</li> | ||
<li>Item 9</li> | ||
<li>Item 10</li> | ||
<li>Item 11</li> | ||
<li>Item 12</li> | ||
<li>Item 13</li> | ||
<li>Item 14</li> | ||
<li>Item 15</li> | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
|
||
const SlidePanelNoMainContent = () => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const handlePanelToggle = () => { | ||
setIsOpen(!isOpen); | ||
}; | ||
|
||
return ( | ||
<div className={cx('example-container')}> | ||
{mainContentForSlidePanel(handlePanelToggle)} | ||
<div className={isOpen ? cx('panel-container') : null}> | ||
<SlidePanel | ||
id="test-slide" | ||
panelContent={panelContentForSlidePanel(handlePanelToggle)} | ||
panelAriaLabel="Panel content area" | ||
panelSize="small" | ||
panelBehavior="overlay" | ||
panelPosition={SlidePanelPositions.END} | ||
isOpen={isOpen} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SlidePanelNoMainContent; |
41 changes: 41 additions & 0 deletions
41
...amework-docs/src/terra-dev-site/test/slide-panel/SlidePanelNoMainContent.test.module.scss
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,41 @@ | ||
:local { | ||
.example-container { | ||
position: relative; | ||
} | ||
|
||
.panel-container > div:first-child { | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
right: 0; | ||
left: 0; | ||
} | ||
|
||
.header-content { | ||
background-color: #d3d3d3; | ||
|
||
p { | ||
width: auto; | ||
display: inline-block; | ||
margin: 0 !important; | ||
} | ||
} | ||
|
||
.header-content > :not(:last-child){ | ||
margin-right: 5px; | ||
} | ||
|
||
.header-content h3 { | ||
display: inline-block; | ||
margin: 0; | ||
padding: 5px; | ||
} | ||
|
||
.content-wrapper { | ||
margin: 5px; | ||
} | ||
|
||
.custom-button { | ||
display: inline-block; | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right? This seems like it would result in an accessibility violation because there's not enough contrast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the highlighted style was updated? May need UX to confirm if this is the correct styling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDIO screenshots for terra-agregator test example which uses slide panel were updated, as with new functionality added, the disclosing node in terra-agregator received the focus. However, the focus style itself hasn't changed, it just wasn't receiving focus before as Slide Panel had no means to return the focus to that node. The affected example is a test example for some other functionality, it is not presented on the doc page and is not relevant to anything important. I don't think we should fix it or log a bug.