Navigating between Visual and Source edit modes

Hey everyone, this is a proposal for the switching between source and visual edit modes in Cristal. Overall, this is pretty straightforward, but I have two options for it, based on the presence of a main edit toolbar.

Visual and Source Mode: Proposal for Mode Switching

  • The Visual mode (called WYSIWYG in XS) is an editor mode where all font choices, colors, and styles appear exactly as the user intends. This is the more intuitive and also the default mode.

  • Source mode, on the other hand, replaces the visual representation of the document with its actual source code as interpreted by the application. This mode primarily serves as a debugging tool, catering to advanced users who need direct control over the document’s structure.

Icon proposal

User Experience Considerations

  • Quick Mode Switching: Transitioning between WYSIWYG and Source mode should be seamless, ideally supported by a simple keystroke for advanced users.
  • Clear Visual Indication in Source Mode: When Source mode is active, the content area should visually reflect this change to ensure users are fully aware of their editing environment. My proposal here is to make it lightly gray not too distracting but clear enough to convey a different mode of operation.

Example of source mode edit:
.

Button Placement for Mode Switching

This proposal presents two possible locations for the button that allows users to switch between modes:

Option 1: With the main toolbar visible:

  • The button would be placed on the toolbar, similar to XS, to maintain consistency of use.

  • Unlike XS, however, its location would be separate from buttons that insert content or modify styles, making it less obtrusive.

Option 2: Without the main toolbar

  • Without the main toolbar, the button can have a less prominent placement.
  • Since mode switching is a secondary feature, the button could be positioned at the bottom of the screen, always visible but outside the main content flow.

  • To switch back to visual mode, the button is replaced by the appropriate icon

Thank you all for reading and, as always, please let me know your opinions on it.

Thanks Thiago. We discussed also addressing XS at the same time when proposing new Cristal UI/UX improvements. I would be interested to discuss how this would apply to XS and make sure we agree about it at the same time. WDYT?

Re the 2 options, I’m not sure I understand. Does it mean that Cristal supports 2 edit modes (with a main toolbar visible and without)? Or, is this a proposal to change the edit UI (by removing the toolbar)?

Thx!

You are right, I forgot abou it when doing the proposal and I’ll update it asap, shouldn’t take too long.

Only one of the options should be available. I posted two because I am not sure at this stage if we’ll provide a default, always visible, toolbar or not.

Currently, we have everything on the toolbar menu, visible when selecting some content and on the slash (/) menu. So option 2 would be used.

Edit: Testing Notion and Cristal a little bit and I could not use the floating toolbar only with my keyboard, so I believe this is a huge accessibility problem. @CharpentierLucas Do you know something about best practices with these type of components? The user is editing text in this context, so a simple arrow up or tab is not enough.

From what I know of CKEditor, you have keyboard commands to do anything, so technically you CAN do anything with keyboard only, even if most people don’t know it all.
For CKEditor, in addition to that, they have a hint for screen readers somewhere at the start of the editor to “Press ALT 0 for help”. Alt 0 opens their accessibility instruction dialog, which contains plenty of info to use the editor with only a keyboard :slight_smile:

General

Editor Toolbar
    Press Alt+F10 to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT+TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button. The focus will be moved back to the editing area upon activating the toolbar button.
Editor Dialog
    Inside a dialog, press TAB to navigate to the next dialog element, press SHIFT+TAB to move to the previous dialog element, press ENTER to submit the dialog, press ESC to cancel the dialog. When a dialog has multiple tabs, the tab list can be reached either with ALT+F10 or with TAB as part of the dialog tabbing order. With tab list focused, move to the next and previous tab with RIGHT and LEFT ARROW, respectively. Press ESC to discard changes and close the dialog. The focus will be moved back to the editing area upon leaving the dialog.
Editor Context Menu
    Press Shift+F10 / Shift+Ctrl+F10 or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.
Editor List Box
    Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.
Editor Element Path Bar
    Press Alt+F11 to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.

Commands

Undo command
    Press Ctrl+Z
Redo command
    Press Ctrl+Y / Shift+Ctrl+Z
Bold command
    Press Ctrl+B
Italic command
    Press Ctrl+I
Underline command
    Press Ctrl+U
Link command
    Press Ctrl+K / Ctrl+L
Access previous focus space command
    Press Shift+Ctrl+3 to access the closest unreachable focus space before the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces.
Access next focus space command
    Press Shift+Ctrl+4 to access the closest unreachable focus space after the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces.
Accessibility Help
    Press Alt+0
Paste as plain text
    Press Shift+Ctrl+V

Having the shortcuts is not enough, you need to let your users know about it for anything that’s non standard :slight_smile:

With CKEditor, they use ALT+F10. I don’t think it’s a standard though.

Hm, I need to check these for the editor in Cristal then. Perhaps there’s something in TipTap as well.

From what I can understand from Guides | Tiptap Docs , they do what they can, but they rely on the person using it to implement a few things, especially those described:
Accessibility | Tiptap Editor Docs

I think the current cristal editor uses tippy to display the floating toolbar, and they do think about accessibility :+1: Accessibility | Tippy.js

Nice, thank you very much.