contenteditable meeting minutes ...

* Present:
	+ Marco & Michael

* Getting a11y / typing merged
	+ this is really a priority for 23.05 ...
	+ but keep finding problems
	+ good to implement Cypress tests - which find problems

* multi-user typing problem ?
	+ in some cases the caret position is mis-placed
	+ we move it with the arrow keys ...
	+ cypress types very quickly

* core notifies atomically:
	+ new content + cursor position
	+ sometimes we just send a cursor position, not new content
	+ eager for us not to have different state on client & server (Michael)
		+ core is the authoritative thing.

* Easy Example:

	core		contenteditable		previous
state:	Hello| world	Hello| world		Hello| world
user:	'p'
	Hello| world	Hellop| world		Hello| world
gen delta previous to content-editable: send a 'p'
    	   	leave this as the previous state.
			Hellop| world		Hellop| world
...
core gets event.
	Hellop| world
kit notify event to JS:
	Hellop| world	-> currently we don't do this.
JS gets it - sets previous & contenteditable concurently.
   	Hellop| world	Hellop| world		Hellop| world


* Harder Example:

	core		contenteditable		previous
state:	Hello| world	Hello| world		Hello| world
user:	'p'
	Hello| world	Hellop| world		Hello| world
gen delta previous to content-editable: send a 'p'
    	   	leave this as the previous state.
			Hellop| world		Hellop| world
...
core gets event.
	Hellop| world
...
user:	'q'
	Hellop| world	Hellopq| world		Hellop| world
gen delta previous to content-editable: send a 'q'
    	   	leave this as the previous state.
			Hellopq| world		Hellopq| world

[ wrong for a bit ]:

kit notify event to JS:
	Hellop| world	-> currently we don't do this.
JS gets it - sets previous & contenteditable concurently.
   	Hellop| world	Hellop| world		Hellop| world

... this is transiently incorrect ... but no problem ...

core gets event.
	Hellopq| world

kit notify event to JS:
	Hellopq| world	-> currently we don't do this.
JS gets it - sets previous & contenteditable concurently.
   	Hellopq| world	Hellop| world		Hellop| world

* systematic cursor wrong positionining

	+ sometimes we may get a systematic cursor offset problem.
		+ this is not known, but may occur.

	core		contenteditable		previous
	:hypothetical mis-matching cursor position:
state:	Hello| world	Hell|o world		Hell|o world
user:	'p'
	Hello| world	Hellp|o world		Hell|o world
gen delta previous to content-editable: send a 'p'
    	   	leave this as the previous state.
			Hellp|o world		Hellp|o world
	... eventually this sorts itself out ...
	:we still have a hypothetical mis-matching cursor position:
	:but we have the right content:
state:	Hellop| world	Hello|p world		Hello|p world

	+ this will create problems for the screenreader, so we
	  need to try to keep the state as synchronized as possible.

* Design thinking here is:
	+ we cannot be fully consistent in the JS at all times
	+ there is always some latency & lag - both for tiles & a11y.
	+ this is inevitable.

* Function of the ContentEditable is -primarily-
	+ to detect difference
	+ and send the right event to the core
	+ and to eventually catch up with the latest state.
	+ it only receives the cursor position from the core
	+ it does not send it - we manage cursors with arrow keys etc.
		+ which are sent as different characters

* Concern: about events coming in during key-press
	+ this cannot happen; we get all key-events & input
	+ then we get new websocket messages.

* Concern: paragraph / text size
	+ we can compress this based on the last string sent;
	  by creating a small diff.
	+ some very trivial LZSS type / delta compression.
	+ do this on a protocol level with the strings
		+ ideally on a byte stream.