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

Pressing the Tab key in restricted editing mode enters a table that's non-editable #15506

Closed
mabryl opened this issue Dec 11, 2023 · 4 comments · Fixed by #16070 or #16220 · May be fixed by AndresElacion/letsConnect#1, AndresElacion/letsConnect#2 or AndresElacion/letsConnect#3
Assignees
Labels
domain:ui/ux This issue reports a problem related to UI or UX. package:restricted-editing release:potential-blocker This issue potentially blocks the upcoming release (should be checked). squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@mabryl
Copy link
Contributor

mabryl commented Dec 11, 2023

📝 Provide detailed reproduction steps (if any)

  1. Create a document that has some editable areas and a non-editable table
  2. Place the caret in the first editable area
  3. Keep pressing the Tab key

✔️ Expected result

The non-editable table should not be focusable when pressing Tab. At the very least, it should be possible to exit the table when pressing Tab again or when pressing Shift + Tab

❌ Actual result

Eventually, the caret will enter the table and get stuck there:

restricted-mode-table.mov

📃 Other details

  • Browser: cross-browser
  • OS: cross-OS
  • First affected CKEditor version: N/A
  • Installed CKEditor plugins: N/A

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@mabryl mabryl added type:bug This issue reports a buggy (incorrect) behavior. domain:ui/ux This issue reports a problem related to UI or UX. support:2 An issue reported by a commercially licensed client. package:restricted-editing squad:core Issue to be handled by the Core team. labels Dec 11, 2023
@Witoso
Copy link
Member

Witoso commented Dec 15, 2023

Rel: #11834.

@Witoso
Copy link
Member

Witoso commented Dec 15, 2023

To make it aligned how tab works in the restricted editing (moving between fields), user should not be able to tab into the table.

If the table has a restricted field, it becomes a focus trap, and you cannot move out.

@illia-stv illia-stv self-assigned this Mar 15, 2024
@arkflpc arkflpc added the release:potential-blocker This issue potentially blocks the upcoming release (should be checked). label Mar 28, 2024
niegowski added a commit that referenced this issue Apr 2, 2024
…-in-restricted-editing-mode-enters-a-table-thats-non-editable

Fix (widget): Native browser `tab` key support should be disabled for cycling nested editable elements inside the editor. Closes #15506.
@CKEditorBot CKEditorBot added this to the iteration 73 milestone Apr 2, 2024
@stevenrai
Copy link

We have tested the release of V41.3.0 and noticed that there continues to be an issue if there is an editable field inside of a table for a restricted editing document.

The user is not able to exit the table and move to the next editable field outside of the table using the tab keys (stuck in an unlimited loop inside of the table).

Screen.Recording.2024-04-10.at.2.37.36.PM.mov

@Witoso Witoso reopened this Apr 11, 2024
@niegowski
Copy link
Contributor

We fixed native focus cycling and missed the custom tab/shift+tab handling.
The solution would be to remove those 2 lines:

editor.keystrokes.set( 'Tab', getCommandExecuter( editor, 'goToNextRestrictedEditingException' ) );
editor.keystrokes.set( 'Shift+Tab', getCommandExecuter( editor, 'goToPreviousRestrictedEditingException' ) );

And replace with this:

this.listenTo<ViewDocumentTabEvent>( editingView.document, 'tab', ( evt, data ) => {
	const commandName = !data.shiftKey ? 'goToNextRestrictedEditingException' : 'goToPreviousRestrictedEditingException';
	const command: Command = editor.commands.get( commandName )!;

	if ( command.isEnabled ) {
		editor.execute( commandName );

		// Stop the event in the DOM: no listener in the web page will be triggered by this event.
		data.preventDefault();
		data.stopPropagation();
	}

	// Stop the event bubbling in the editor: no more callbacks will be executed for this keystroke.
	evt.stop();
}, { context: '$capture' } );

This uses the event bubbling and stops bubbling at the $capture stage so other features should not react to that event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment