Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6023: Support NumpadEnter #6025

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/lib/accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
break;

case 'Enter':
case 'NumpadEnter':
case 'Space':
onTabEnterKey(event, tab, index);
break;
Expand Down
8 changes: 4 additions & 4 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export const Calendar = React.memo(
};

const onPickerKeyDown = (event, type, direction) => {
if (event.code === 'Enter' || event.code === 'Space') {
if (event.key === 'Enter' || event.key === 'Space') {
onTimePickerElementMouseDown(event, type, direction);
event.preventDefault();

Expand All @@ -229,7 +229,7 @@ export const Calendar = React.memo(
};

const onPickerKeyUp = (event) => {
if (event.code === 'Enter' || event.code === 'Space') {
if (event.key === 'Enter' || event.key === 'Space') {
onTimePickerElementMouseUp();
event.preventDefault();

Expand Down Expand Up @@ -1670,7 +1670,7 @@ export const Calendar = React.memo(
};

const switchToMonthView = (event) => {
if (event && event.code && (event.code === 'Enter' || event.code === 'Space')) {
if (event && event.code && (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space')) {
viewChangedWithKeyDown.current = true;
}

Expand All @@ -1679,7 +1679,7 @@ export const Calendar = React.memo(
};

const switchToYearView = (event) => {
if (event && event.code && (event.code === 'Enter' || event.code === 'Space')) {
if (event && event.code && (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space')) {
viewChangedWithKeyDown.current = true;
}

Expand Down
2 changes: 1 addition & 1 deletion components/lib/chip/Chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Chip = React.memo(
useHandleStyle(ChipBase.css.styles, isUnstyled, { name: 'chip' });

const onKeyDown = (event) => {
if (event.code === 'Enter' || event.code === 'Backspace') {
if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Backspace') {
close(event);
}
};
Expand Down
1 change: 1 addition & 0 deletions components/lib/contextmenu/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ export const ContextMenu = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
onEnterKey(event);
break;

Expand Down
2 changes: 1 addition & 1 deletion components/lib/datatable/BodyCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export const BodyCell = React.memo((props) => {

const onKeyDown = (event) => {
if (props.editMode !== 'row') {
if (event.code === 'Enter' || event.code === 'Tab') {
if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Tab') {
switchCellToViewMode(event, true);
}

Expand Down
1 change: 1 addition & 0 deletions components/lib/datatable/BodyRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const BodyRow = React.memo((props) => {
break;

case 'Enter':
case 'NumpadEnter':
onEnterKey(row, event, target);
break;

Expand Down
2 changes: 1 addition & 1 deletion components/lib/datatable/HeaderCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const HeaderCell = React.memo((props) => {
};

const onKeyDown = (event) => {
if ((event.code == 'Enter' || event.code == 'Space') && event.currentTarget === elementRef.current && DomHandler.getAttribute(event.currentTarget, 'data-p-sortable-column') === 'true') {
if ((event.code == 'Enter' || event.code === 'NumpadEnter' || event.code == 'Space') && event.currentTarget === elementRef.current && DomHandler.getAttribute(event.currentTarget, 'data-p-sortable-column') === 'true') {
onClick(event);

event.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions components/lib/dock/Dock.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const Dock = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
case 'Space':
onSpaceKey(event);
event.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export const Dropdown = React.memo(

case 'Escape':
case 'Enter':
case 'NumpadEnter':
onEnterKey(event);
event.preventDefault();
break;
Expand Down
2 changes: 1 addition & 1 deletion components/lib/fieldset/Fieldset.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const Fieldset = React.forwardRef((inProps, ref) => {
});

const onKeyDown = (event) => {
if (event.code === 'Enter' || event.code === 'Space') {
if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') {
toggle(event);
event.preventDefault();
}
Expand Down
2 changes: 1 addition & 1 deletion components/lib/fileupload/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export const FileUpload = React.memo(
};

const onKeyDown = (event) => {
if (event.code === 'Enter') {
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
choose();
}
};
Expand Down
1 change: 1 addition & 0 deletions components/lib/galleria/GalleriaItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const GalleriaItem = React.memo(
const onIndicatorKeyDown = (event, index) => {
switch (event.code) {
case 'Enter':
case 'NumpadEnter':
case 'Space':
stopSlideShow();

Expand Down
2 changes: 1 addition & 1 deletion components/lib/galleria/GalleriaThumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const GalleriaThumbnailItem = React.memo((props) => {
};

const onThumbnailKeydown = (event) => {
if (event.code === 'Enter' || event.code === 'Space') {
if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') {
props.onItemClick({
originalEvent: event,
index: props.index
Expand Down
2 changes: 1 addition & 1 deletion components/lib/inplace/Inplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const Inplace = React.forwardRef((inProps, ref) => {
};

const onDisplayKeyDown = (event) => {
if (event.code === 'Enter' || event.code === 'Space') {
if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') {
open(event);
event.preventDefault();
}
Expand Down
1 change: 1 addition & 0 deletions components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ export const InputNumber = React.memo(
case 'Tab':
case 'NumpadEnter':
case 'Enter':
case 'NumpadEnter':
newValueStr = validateValue(parseValue(inputValue));
inputRef.current.value = formatValue(newValueStr);
inputRef.current.setAttribute('aria-valuenow', newValueStr);
Expand Down
2 changes: 1 addition & 1 deletion components/lib/megamenu/MegaMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export const MegaMenu = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
onEnterKey(event);
break;

Expand All @@ -406,7 +407,6 @@ export const MegaMenu = React.memo(
case 'PageUp':
case 'Backspace':
case 'ShiftLeft':
focusedItemInfo;
case 'ShiftRight':
//NOOP
break;
Expand Down
1 change: 1 addition & 0 deletions components/lib/menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const Menu = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
onEnterKey(event);
break;

Expand Down
3 changes: 2 additions & 1 deletion components/lib/menubar/Menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const Menubar = React.memo(
};

const menuButtonKeydown = (event) => {
(event.code === 'Enter' || event.code === 'Space') && toggle(event);
(event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') && toggle(event);
};

const isOutsideClicked = (event) => {
Expand Down Expand Up @@ -167,6 +167,7 @@ export const Menubar = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
onEnterKey(event);
break;

Expand Down
1 change: 1 addition & 0 deletions components/lib/speeddial/SpeedDial.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const SpeedDial = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
case 'Space':
onEnterKey(event);
break;
Expand Down
2 changes: 2 additions & 0 deletions components/lib/splitter/Splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ export const Splitter = React.memo(
break;
}

case 'NumpadEnter':

case 'Enter': {
if (prevSize.current >= 100 - (minSize || 5)) {
resizePanel(index, minSize, 100 - minSize);
Expand Down
1 change: 1 addition & 0 deletions components/lib/steps/Steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const Steps = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
case 'Space':
itemClick(event, item, index);
event.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions components/lib/tabmenu/TabMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const TabMenu = React.memo(

case 'Space':
case 'Enter':
case 'NumpadEnter':
itemClick(event, item, index);
event.preventDefault();
break;
Expand Down
1 change: 1 addition & 0 deletions components/lib/tabview/TabView.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const TabView = React.forwardRef((inProps, ref) => {
break;

case 'Enter':
case 'NumpadEnter':
case 'Space':
onTabEnterKey(event, tab, index);
break;
Expand Down
1 change: 1 addition & 0 deletions components/lib/terminal/Terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const Terminal = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
if (!!commandTextState) {
let newCommands = [...commandsState];

Expand Down
1 change: 1 addition & 0 deletions components/lib/tieredmenu/TieredMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const TieredMenu = React.memo(
break;

case 'Enter':
case 'NumpadEnter':
onEnterKey(event);
break;

Expand Down
2 changes: 1 addition & 1 deletion components/lib/treetable/TreeTableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const TreeTableHeader = React.memo((props) => {
};

const onHeaderKeyDown = (event, column) => {
if (event.key === 'Enter' && event.key === 'Space') {
if (event.key === 'Enter' || event.code === 'Space') {
onHeaderClick(event, column);
event.preventDefault();
}
Expand Down
2 changes: 1 addition & 1 deletion components/lib/tristatecheckbox/TriStateCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const TriStateCheckbox = React.memo(
};

const onKeyDown = (e) => {
if (e.code === 'Enter' || e.code === 'Space') {
if (e.code === 'Enter' || e.code === 'NumpadEnter' || e.code === 'Space') {
onChange(e);
e.preventDefault();
}
Expand Down
Loading