diff --git a/CHANGELOG.md b/CHANGELOG.md index 3334be8754..d4e81aa571 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [10.3.1](https://github.com/primefaces/primereact/tree/10.3.1) (2024-01-10) + +[Full Changelog](https://github.com/primefaces/primereact/compare/10.3.0...10.3.1) + +**Fixed bugs:** + +- Port missing fixes [\#5707](https://github.com/primefaces/primereact/issues/5707) +- Image: ReferenceError: rotate is not defined image.esm.js (948:0) [\#5704](https://github.com/primefaces/primereact/issues/5704) +- 'content' property now required for several components [\#5701](https://github.com/primefaces/primereact/issues/5701) +- MegaMenu: Menu Items not showing without StrictMode (production) only after a stateupdate [\#5699](https://github.com/primefaces/primereact/issues/5699) +- Confirm Dialog: Demo opening dialog 3 times [\#5697](https://github.com/primefaces/primereact/issues/5697) +- Primereact in the Shadow DOM has problems with the Dropdown component style [\#5246](https://github.com/primefaces/primereact/issues/5246) +- TypeScript: 10.3.0 Components complaining content is required [\#5692](https://github.com/primefaces/primereact/issues/5692) + ## [10.3.0](https://github.com/primefaces/primereact/tree/10.3.0) (2024-01-05) [Full Changelog](https://github.com/primefaces/primereact/compare/10.2.1...10.3.0) @@ -678,6 +692,7 @@ - Calendar: `view` typescript missing `year` [\#4163](https://github.com/primefaces/primereact/issues/4163) - Ripple: first click on component has incorrect location [\#4160](https://github.com/primefaces/primereact/issues/4160) - primereact.min.css Error at background:transparent URL\(\) with base64 image [\#4097](https://github.com/primefaces/primereact/issues/4097) +- ConfirmDialog: is not loading inside a Shadow DOM [\#4096](https://github.com/primefaces/primereact/issues/4096) ## [9.2.1](https://github.com/primefaces/primereact/tree/9.2.1) (2023-03-15) diff --git a/components/lib/picklist/PickList.js b/components/lib/picklist/PickList.js index 9c7ccc6dc8..3ccdd9f7f4 100644 --- a/components/lib/picklist/PickList.js +++ b/components/lib/picklist/PickList.js @@ -248,7 +248,7 @@ export const PickList = React.memo( props.onBlur && props.onBlur(event); }; - const onItemClick = (event, type) => { + const onItemClick = (event, type, arrowKeyClick = false) => { let originalEvent = event.originalEvent; let item = event.value; let selectedId = event.id; @@ -258,10 +258,10 @@ export const PickList = React.memo( let selected = index !== -1; let metaSelection = props.metaKeySelection; - setFocusedOptionIndex(selectedId); + if (!arrowKeyClick) setFocusedOptionIndex(selectedId); if (metaSelection) { - const metaKey = originalEvent.metaKey || originalEvent.ctrlKey; + const metaKey = originalEvent.metaKey || originalEvent.ctrlKey || originalEvent.shiftKey; if (selected && metaKey) { selection.splice(index, 1); @@ -334,11 +334,12 @@ export const PickList = React.memo( const onArrowDownKey = (event, type) => { const optionIndex = findNextOptionIndex(focusedOptionIndex, type); + const visibleList = getVisibleList(type === 'source' ? props.source : props.target, type); changeFocusedOptionIndex(optionIndex, type); - if (event.shiftKey) { - onEnterKey(event, type); + if (visibleList && visibleList.length > 0 && event.shiftKey) { + onItemClick({ originalEvent: event, value: visibleList[optionIndex] }, type, true); } event.preventDefault(); @@ -346,11 +347,12 @@ export const PickList = React.memo( const onArrowUpKey = (event, type) => { const optionIndex = findPrevOptionIndex(focusedOptionIndex, type); + const visibleList = getVisibleList(type === 'source' ? props.source : props.target, type); changeFocusedOptionIndex(optionIndex, type); - if (event.shiftKey) { - onEnterKey(event, type); + if (visibleList && visibleList.length > 0 && event.shiftKey) { + onItemClick({ originalEvent: event, value: visibleList[optionIndex] }, type, true); } event.preventDefault(); @@ -358,7 +360,7 @@ export const PickList = React.memo( const onEnterKey = (event, type) => { const listElement = getListElement(type); - const visibleList = type === 'source' ? props.source : props.target; + const visibleList = getVisibleList(type === 'source' ? props.source : props.target, type); const items = DomHandler.find(listElement, '[data-pc-section="item"]'); const focusedItem = DomHandler.findSingle(listElement, `[data-pc-section="item"][id=${focusedOptionIndex}]`); const id = focusedItem && focusedItem.getAttribute('id'); @@ -399,14 +401,13 @@ export const PickList = React.memo( const onHomeKey = (event, type) => { if (event.ctrlKey && event.shiftKey) { - const isSource = type === 'sourceList'; + const isSource = type === 'source'; const listItems = isSource ? sourceList : targetList; const listElement = getListElement(type); const items = DomHandler.find(listElement, '[data-pc-section="item"]'); const focusedItem = DomHandler.findSingle(listElement, `[data-pc-section="item"][id=${focusedOptionIndex}]`); const matchedOptionIndex = [...items].findIndex((item) => item === focusedItem); - - selection = [...listItems].slice(0, matchedOptionIndex + 1); + const selection = [...listItems].slice(0, matchedOptionIndex + 1); if (isSource) { onSelectionChange({ originalEvent: event, value: selection }, 'sourceSelection', props.onSourceSelectionChange); @@ -425,7 +426,7 @@ export const PickList = React.memo( const items = DomHandler.find(listElement, '[data-pc-section="item"]'); if (event.ctrlKey && event.shiftKey) { - const isSource = type === 'sourceList'; + const isSource = type === 'source'; const listItems = isSource ? sourceList : targetList; const focusedItem = DomHandler.findSingle(listElement, `[data-pc-section="item"][id=${focusedOptionIndex}]`); const matchedOptionIndex = [...items].findIndex((item) => item === focusedItem); diff --git a/components/lib/treeselect/TreeSelect.js b/components/lib/treeselect/TreeSelect.js index 9b253bb58e..0a3bec8790 100644 --- a/components/lib/treeselect/TreeSelect.js +++ b/components/lib/treeselect/TreeSelect.js @@ -234,7 +234,13 @@ export const TreeSelect = React.memo( break; case 'Tab': - onTabKey(event); + if (overlayVisibleState) { + event.preventDefault(); + + if (event.shiftKey) setFocusToFocusableFirstNode(); + else onTabKey(event); + } + break; default: @@ -856,6 +862,7 @@ export const TreeSelect = React.memo( scrollHeight={props.scrollHeight} onClick={onOverlayClick} header={header} + hide={hide} footer={footer} firstHiddenFocusableElementOnOverlay={} lastHiddenFocusableElementOnOverlay={} diff --git a/components/lib/treeselect/TreeSelectPanel.js b/components/lib/treeselect/TreeSelectPanel.js index af493953da..67e3534713 100644 --- a/components/lib/treeselect/TreeSelectPanel.js +++ b/components/lib/treeselect/TreeSelectPanel.js @@ -15,6 +15,13 @@ export const TreeSelectPanel = React.forwardRef((props, ref) => { }); }; + const onKeyDown = (event) => { + if (event.key === 'Escape') { + event.preventDefault(); + props.hide(); + } + }; + const createElement = () => { const wrapperStyle = { maxHeight: props.scrollHeight || 'auto' }; @@ -22,6 +29,7 @@ export const TreeSelectPanel = React.forwardRef((props, ref) => { { className: cx('panel', { panelProps: props, context }), style: props.panelStyle, + onKeyDown: onKeyDown, onClick: props.onClick }, getPTOptions('panel') diff --git a/package-lock.json b/package-lock.json index c5f13b365b..d518a48b90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "primereact", - "version": "10.3.1-SNAPSHOT", + "version": "10.4.0-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "primereact", - "version": "10.3.1-SNAPSHOT", + "version": "10.4.0-SNAPSHOT", "dependencies": { "@docsearch/react": "3.5.2", "chart.js": "4.4.0", diff --git a/package.json b/package.json index 19df9cbdfa..1b48f1a99f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "primereact", "private": false, - "version": "10.3.1-SNAPSHOT", + "version": "10.4.0-SNAPSHOT", "scripts": { "dev": "next dev", "start": "next start",