-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Text formatting mode lost after backspace is used #34938
Comments
Possibly also related: wordpress-mobile/gutenberg-mobile#2055 |
@guarani Not sure if it refers to the bold format button located in the toolbar, if so, I noticed in the video and testing locally that the button is in its enabled state after pressing backspace, is this step accurate? |
You're right @fluiddot, I've now fixed that step above (not sure why I had that in there originally). |
After checking both web and native version behaviors related to the calculation of the active format (reference), looks like there are some differences but I couldn't find yet the culprit of this issue. I'll keep exploring the web version (reference) in case there are any potential cases we might be missing in the native version hence, we should incorporate. |
Upon further investigations, I found that the issue is unrelated to what I stated in the previous comment but Aztec which automatically recalculates the active text format when pressing the backspace key (i.e. deleting backward), as shown in the following example on an empty paragraph: 1. Enable bold format (note the font attribute attribute
2. Type
3. Press the backspace key (note the font attribute change to
This explains the behavior described in the issue, the bold format button is active because it's controlled by the RichtText component, however, the active format in Aztec is different. This change is produced when handling the event produced by pressing the backspace button (reference) which calls the A potential workaround for this would be to prevent that Aztec from executing the typing attributes recalculation, and let the RichText component be in full control of the active format. I applied this solution in the following PRs:
Something I noticed is that on Android this issue can't be reproduced, although it also produces a mismatching on the active format between Aztec and the format toolbar on a different case. Screen_Recording_20211231-131413_WordPress.Pre-Alpha.mp4For this case, I opened another PR with a similar change, although for this case, the selected styles (i.e. the active format) were being modified by Aztec on text changes. |
Oops, seems like I didn't delete this earlier, fixed now. |
Description
If the user has formatting ON (e.g. bold) and types text, then deletes a portion of it, the formatting is turned OFF as soon as the backspace key is tapped.
Step-by-step reproduction instructions
Expected behaviour
I expect that deleting text should not reset formatting (bold, italics, strikethrough, etc). On Gutenberg web and the Gutenberg Android demo app, deleting does not reset formatting.
Actual behaviour
Tapping backspace resets formatting to its default state of regular text weight, emphasis, etc.
Screenshots or screen recording (optional)
bold-ios.mov
Device information
trunk
: fcc32eeAdditional info
First reported in wordpress-mobile/gutenberg-mobile#757 (comment)
The text was updated successfully, but these errors were encountered: