-
Notifications
You must be signed in to change notification settings - Fork 8
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
Rich Text Editor | Toggle buttons should be able to handle their own interactions like click, keydown #1441
Comments
@jattasNI, @rajsite, @mollykreis
With the above behaviors while using the @change event - we're not able to distinguish if the change event was emitted from user interaction or it gets fired from toggle button programmatically. This makes us to use @click and @keydown events again to capture user interactions. Looks like this is a special case of toggle buttons getting toggled automatically for formatting options as we traverse through the rich text editor. Having said this, we're updating the toggle-button's It would also be helpful if there's a way to send any custom properties while the change event is being triggered from programmatically updating the checked property by this we will let us distinguish the event triggered from user interaction. |
I would consider it a bug that the toggle button is firing a I'm not sure what a good next step is. Some options:
We've done both 1 and 2 for previous bug fixes, but they are a fair amount of work (probably at least a week for someone who hasn't done it before). Option 3 could be quicker but might result in ugly state management code (but that code may be less ugly than the workarounds we already have); that assumes we can find a workaround that even succeeds. Option 4 is a sad outcome but maybe not terrible. I'm curious for @rajsite and @mollykreis opinions or other ideas. I think my vote given your team's experience level would be to try 3 if we can but fall back to 4 if we can't find an answer we're happy with. |
We could also look into passing some custom property on the change event while setting the checked value programmatically if that's possible @rajsite , @mollykreis . With regards to 3rd option, we will have some more additional state management code which will be replaced eventually when toggle button fixes this issue. So will wait for any further inputs from Milan and Molly to check if there are other approaches as well to fine tune this. Otherwise, unfortunately we have to settle down on 4th option until we have this fixed considering our other business delivery priorities😔. |
I don't see a good way to pass a custom property on the change event while setting the checked value programmatically. The code that fires that event is pretty deep within the FAST code (i.e. in their form-associated base class), so I'm not sure how you'd go about identifying the cases where the event should include that custom property and then putting that in the event. We had to use an approach similar to 3 to get row selection checkboxes to work correctly in the nimble-table because we faced similar issues. |
Marking as blocked on microsoft/fast#5750. If someone comes up with a solution that doesn't require that, or if that gets fixed by FAST or us, we can mark it unblocked. |
Removed the blocked label because we could work on this by forking the template. We can prioritize doing that vs other tech debt. |
🧹 Tech Debt
Currently, the toggle buttons employed in the
nimble-rich-text-editor
toolbar use theclick
andkeydown
events for toggling text formats within the editor, as well as for managing the active state of the buttons. Instead, it is recommended to adopt thechange
event to toggle text formats. By doing so, the responsibility for these interactions will shift from the rich text editor to the toggle button itself.Refer to this conversation for more details: #1416 (comment)
The text was updated successfully, but these errors were encountered: