Skip to content

Commit

Permalink
Merge branch 'master' into fix-5686
Browse files Browse the repository at this point in the history
  • Loading branch information
kl-nevermore committed Jan 10, 2024
2 parents 534bcae + 1a05a21 commit 061d863
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 54 deletions.
29 changes: 28 additions & 1 deletion components/doc/common/apidoc/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -51677,7 +51677,34 @@
"description": "Uses to pass attributes to the Tooltip component."
}
],
"callbacks": []
"callbacks": [
{
"name": "onFocus",
"parameters": [
{
"name": "event",
"optional": false,
"type": "SyntheticEvent<Element, Event>",
"description": "Browser event."
}
],
"returnType": "void",
"description": "Callback to invoke when menu receives focus."
},
{
"name": "onBlur",
"parameters": [
{
"name": "event",
"optional": false,
"type": "SyntheticEvent<Element, Event>",
"description": "Browser event."
}
],
"returnType": "void",
"description": "Callback to invoke when menu loses focus."
}
]
},
"TreeSelectState": {
"description": "Defines current inline state in TreeSelect component.",
Expand Down
6 changes: 6 additions & 0 deletions components/doc/organizationchart/accessibilitydoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export function AccessibilityDoc() {
</td>
<td>Toggles the expanded state of a node.</td>
</tr>
<tr>
<td>
<i>numpad enter</i>
</td>
<td>Toggles the expanded state of a node.</td>
</tr>
</tbody>
</table>
</div>
Expand Down
9 changes: 9 additions & 0 deletions components/lib/organizationchart/OrganizationChartNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export const OrganizationChartNode = React.memo((props) => {
event.preventDefault();
};

const onKeyDown = (event, node) => {
if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') {
toggleNode(event, node);
event.preventDefault();
}
};

const createChildNodes = () => {
const nodesProps = mergeProps(
{
Expand Down Expand Up @@ -198,6 +205,8 @@ export const OrganizationChartNode = React.memo((props) => {
const nodeTogglerProps = mergeProps(
{
className: cx('nodeToggler'),
tabIndex: 0,
onKeyDown: (e) => onKeyDown(e, node),
onClick: (e) => toggleNode(e, node),
href: '#'
},
Expand Down
14 changes: 6 additions & 8 deletions components/lib/picklist/PickList.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,22 @@ export const PickList = React.memo(

const handleScrollPosition = (listElement, direction) => {
if (listElement) {
let list = DomHandler.findSingle(listElement, '[data-pc-section="list"]');

switch (direction) {
case 'up':
scrollInView(list, -1);
scrollInView(listElement, -1);
break;

case 'top':
list.scrollTop = 0;
listElement.scrollTop = 0;
break;

case 'down':
scrollInView(list, 1);
scrollInView(listElement, 1);
break;

case 'bottom':
/* TODO: improve this code block */
setTimeout(() => (list.scrollTop = list.scrollHeight), 100);
setTimeout(() => (listElement.scrollTop = listElement.scrollHeight), 100);
break;

default:
Expand Down Expand Up @@ -602,7 +600,7 @@ export const PickList = React.memo(
onListBlur={(e) => onListBlur(e, 'source')}
onOptionMouseDown={(index) => onOptionMouseDown(index, 'source')}
onItemClick={(e) => onItemClick(e, 'source')}
focusedOptionId={focusedOptionId}
focusedOptionId={focused['source'] ? focusedOptionId : null}
ariaActivedescendant={focused['source'] ? focusedOptionId : null}
itemTemplate={sourceItemTemplate}
header={props.sourceHeader}
Expand Down Expand Up @@ -656,7 +654,7 @@ export const PickList = React.memo(
onListBlur={(e) => onListBlur(e, 'target')}
onOptionMouseDown={(index) => onOptionMouseDown(index, 'target')}
onItemClick={(e) => onItemClick(e, 'target')}
focusedOptionId={focusedOptionId}
focusedOptionId={focused['target'] ? focusedOptionId : null}
ariaActivedescendant={focused['target'] ? focusedOptionId : null}
itemTemplate={targetItemTemplate}
header={props.targetHeader}
Expand Down
Loading

0 comments on commit 061d863

Please sign in to comment.