Skip to content

Commit

Permalink
Updates so that pressing enter tries to apply a row filter
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarenerd committed Apr 1, 2024
1 parent d0af93a commit d9361f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const PositronModalDialog = (props: PropsWithChildren<PositronModalDialog
// Enter accepts dialog.
case 'Enter': {
consumeEvent();
props.onAccept?.();
props.onAccept();
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface PositronModalPopupProps {
height: number | 'min-content';
focusableElementSelectors?: string;
keyboardNavigation: KeyboardNavigation;
onAccept?: () => void;
}

/**
Expand Down Expand Up @@ -195,6 +196,13 @@ export const PositronModalPopup = (props: PropsWithChildren<PositronModalPopupPr

// Handle the event.
switch (e.code) {
// Ender accepts the modal popup.
case 'Enter': {
consumeEvent();
props.onAccept?.();
break;
}

// Escape dismisses the modal popup.
case 'Escape': {
consumeEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ export const AddEditRowFilterModalPopup = (props: AddEditRowFilterModalPopupProp
})();

/**
* Apply row filter button onPressed handler.
* Applies the row filter, if it is valid.
*/
const applyRowFilterButtonPressed = () => {
const applyRowFilter = () => {
// Ensure that the user has selected a column schema.
if (!selectedColumnSchema) {
setErrorText(localize(
Expand Down Expand Up @@ -546,6 +546,7 @@ export const AddEditRowFilterModalPopup = (props: AddEditRowFilterModalPopupProp
width={275}
height={'min-content'}
keyboardNavigation='dialog'
onAccept={applyRowFilter}
>
<div className='add-edit-row-filter-modal-popup-body'>
<DropDownColumnSelector
Expand Down Expand Up @@ -593,7 +594,7 @@ export const AddEditRowFilterModalPopup = (props: AddEditRowFilterModalPopupProp
)}
<Button
className='solid button-apply-row-filter'
onPressed={applyRowFilterButtonPressed}
onPressed={applyRowFilter}
>
{localize(
'positron.addEditRowFilter.applyFilter',
Expand Down

0 comments on commit d9361f9

Please sign in to comment.