Skip to content

Commit

Permalink
Merge pull request #144 from irontec/CDT-215-prevent-tab-event-propag…
Browse files Browse the repository at this point in the history
…ation-on-dialogs

Prevented tab propagation from Dialogs
  • Loading branch information
rbatistadev authored Nov 27, 2024
2 parents 650d434 + 96c8249 commit a5fc2e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@irontec/ivoz-ui",
"version": "1.7.0",
"version": "1.7.1",
"description": "UI library used in ivozprovider",
"license": "GPL-3.0",
"main": "index.js",
Expand Down
7 changes: 7 additions & 0 deletions library/src/components/shared/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ export default function ConfirmDialog(props: ConfirmDialogProps): JSX.Element {
[]
);

const handleKeyDown = (event: React.KeyboardEvent) => {
if (event.key === 'Tab') {
event.stopPropagation();
}
};

const sumbitEnabled = !doubleCheck || inputVal == doubleCheckExpectedStr;

return (
Expand All @@ -63,6 +69,7 @@ export default function ConfirmDialog(props: ConfirmDialogProps): JSX.Element {
onClose={handleClose}
aria-labelledby='alert-dialog-slide-title'
aria-describedby='alert-dialog-slide-description'
onKeyDown={handleKeyDown}
>
<CloseRoundedIcon className='close-icon' onClick={handleClose} />
<img src='assets/img/delete-dialog.svg' className='modal-icon' />
Expand Down
7 changes: 7 additions & 0 deletions library/src/components/shared/ConfirmEditDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export const ConfirmEditionDialog = (props: ConfirmEditDialogProps) => {
const TOTAL_TIME = 100;
const [progress, setProgress] = useState(TOTAL_TIME);

const handleKeyDown = (event: React.KeyboardEvent) => {
if (event.key === 'Tab') {
event.stopPropagation();
}
};

useEffect(() => {
let timer: NodeJS.Timeout | null = null;
if (open) {
Expand Down Expand Up @@ -64,6 +70,7 @@ export const ConfirmEditionDialog = (props: ConfirmEditDialogProps) => {
TransitionComponent={Transition}
keepMounted
onClose={handleClose}
onKeyDown={handleKeyDown}
aria-labelledby='alert-dialog-slide-title'
aria-describedby='alert-dialog-slide-description'
>
Expand Down

0 comments on commit a5fc2e8

Please sign in to comment.