cds-snc / platform-forms-client

NextJS application that serves the public-facing website for Forms
https://forms-staging.cdssandbox.xyz/
MIT License
31 stars 12 forks source link

Heading button in WYSIWYG editor does not always apply instantly when clicked #3404

Open anikbrazeau opened 3 months ago

anikbrazeau commented 3 months ago

Description

Clicking on H2 or H3 does not always immediately apply the styling. Though this is inconsistent.

Steps to reproduce

  1. Go to form builder > create a form > edit
  2. Click on "Add a form element"
  3. Scroll down to "Page text"
  4. Add page text
  5. Try to click on H2 and H3
  6. Type text and then select it and try to click H2 and H3
  7. Sometimes it works, sometimes it doesn't

Details

Expected behaviour

Formatting applied immediately and predictably

Screenshots or videos

heading

dsamojlenko commented 2 months ago

I think I see what you're seeing, not sure it's a bug (or if it is, if it's one we can fix). What I think is happening:

The key difference being whether the cursor enters the text area first, which initializes the contents of the text area. Until that happens, there is no text to apply the formatting to.

anikbrazeau commented 2 months ago

I think this might be okay to descope, it does not appear to be as jarring now.

When we have more capacity, it seems the behaviour might be different between the "form description" field and an added "page text" field, in terms of whether the cursor is in the text area?

timarney commented 2 months ago

@Abi-Nada can we remove this from the app router work and explore further outside the current epics?

Abi-Nada commented 2 months ago

Yeah, let's descope for now