This stackoverflow post has a good summary of the differences between disabled and readonly.
I've summarized some of the expected behaviors for readonly and disabled html elements and the current behavior of slate when slate is in readonly mode.
focus
tab navigation
editable
click
readonly
yes
yes
no
yes
disabled
no
no
no
no
slate readonly
no
no
no
no
I'm unfortunately implementing a lock based collaborative editor where the editor is in readonly and when you click on it you request a lock. Once you get the lock the editor becomes editable. The problem is the click event doesn't fire if the editor is in readonly mode.
Some of these issues could be easy to fix for example in onClick I think the isEventHandled just needs to be moved before readOnly.
+1 I have a use case where when the editor is read only there are still certain elements which upon click drives a navigation panel outside the slate editor
This stackoverflow post has a good summary of the differences between disabled and readonly.
I've summarized some of the expected behaviors for readonly and disabled html elements and the current behavior of slate when slate is in readonly mode.
I'm unfortunately implementing a lock based collaborative editor where the editor is in readonly and when you click on it you request a lock. Once you get the lock the editor becomes editable. The problem is the click event doesn't fire if the editor is in readonly mode.
Some of these issues could be easy to fix for example in
onClick
I think theisEventHandled
just needs to be moved beforereadOnly
.https://github.com/ianstormtaylor/slate/blob/4c3e737dda95d5ab67a94af903b25512d926c7fe/packages/slate-react/src/components/editable.tsx#L575-L582
focus may be harder since getting focus looks like it causes side effects.
Anyway my issue is resolved by using
mouseDown
instead ofclick
but I thought it would be worth reporting since this felt unexpected.