Editor with widgets: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(31 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Propose==
= Problem=
HTML5 introduced an ability to make entire HTML document or its part editable. However [http://www.w3.org/TR/html5/editing.html#contenteditable specification] didn't provide complete documentation defining behaviour of HTML elements inside of editable area. Especially it concerns to HTML forms where the spec has few lines only. It leads to many things can be treated in different ways in question. So it's necessary to provide well-defined rules because this will allow to achieve compatibility between user agents. For example HTML form elements behaves differently in different versions of IE and Mozilla editor doesn't work well enough with them at all. So currently form elements are outsiders of editable world of HTML documents.


The target of the article is to specify the behavior of Mozilla editor in case of it using in containers with contentEditable attribute and with widgets inside of the editing field.
This article is designed to define behavior of editor used for editable HTML documents on user actions.


==Application area==
==Application area==


# Development gecko based WYSIWYG XForms editors. An example of WYSIWYG XForms editor is Microsoft Office InfoPath.
Now editor is used in HTML authoring tools. With using HTML form controls will be possible to develope:
# Editor of not fully structured forms.
# authoring tools for WYSIWYG development data entry forms. An example of the tool is Microsoft Office InfoPath.
 
# authoring tools for semistructured (loosely structured) forms. Semistructured forms can be constructed via HTML by placing XForms controls inside editable area. An example of application area of semistructured forms are clinical documents. Clinical document authoring tool can be used for developing clinical documents with providing easy-to-use interfaces.
Необходимость в таких формах возникает при формировании Clinical Documents.
 
 
The specification is corresponding with behavior of Microsoft Internet Explorer 6,7,8 and Microsoft Office InfoPath.


The specification is corresponding with behavior of Microsoft Internet Explorer 6,7,8 and Microsoft Office InfoPath 2003.


==Examples==
==Examples==
Line 18: Line 16:
* Simple  WYSIWYG XForms editors
* Simple  WYSIWYG XForms editors


= Proposal=


==Widgets in containers with contentEditable attribute==
==Widgets in containers with contentEditable attribute==
The common approach - the behavior of widgets is the same with the HTML specification. But in HTML widgets are in the static place and in the editor widgets is a part of editing text, it is possible to cut, copy and paste widgets by clipboard.  
The common approach - the behavior of widgets is the same with the HTML specification. But in HTML widgets are in the static place and in the editor widgets is a part of editing text, it is possible to cut, copy and paste widgets by clipboard.  


 
===Common behavior for all type of widgets in editable area===
===Common behavior for all type of widgets in editing fields===
# if the caret is directly before/after the widget, then pressing right/left arrow key instead of next right/left caret's position to focus on the widget
# if the caret is directly before/after the widget then instead of next right/left caret's position the focus is on the widget.
# if the caret is directly before/after a widget then pressing of delete/backspace key is removing the widget
# if the caret is directly before/after a widget then pressing of delete/backspace key is removing the widget
# if the widget has focus then pressing of delete/backspace key is removing the widget
# if the widget has focus then pressing of delete/backspace key is removing the widget
# widget has to receive all events (onclick, onchange etc)
# if widget has focus or widget is in the editor's selection then it is possible to copy (cut) the widget to clipboard and paste it to other place of the editing field or other field


===SELECT===
===SELECT===
# if the widget has focus then pressing down/up key should change current value of widget's text field from widgets list. When the last/first list's value is achieved then the following pressing up/down key has no affects.
# if the widget has focus then pressing down/up key should change current value of widget's text field from widgets list. When the last/first list's value is achieved then the following pressing up/down key has no affects.
# mouse click on widget's text field should move focus to it and open widget's menu
# mouse click on widget's text field should move focus to it and open widget's menu
# double click should open and close widget's menu
# double click should open and close widget's menu, i.e. action analogous to two single clicks is executed
 


===BUTTON===
===BUTTON===
# if the button has focus and widget has onclick handler then pressing enter key should perform onlick handler
# if button has no focus then mouse click on button should move focus to button and execute onclick handler
# if button has no focus then mouse click on button should move focus to button
# double click on button moves focus to button and performs  onclick handler


===INPUT type="text"===
===INPUT type="text"===
# if caret is directly before/after the text field then pressing right/left key should move caret into widget's text field in the first/last position of the field's content. If the widget's content is larger then text field should be scrolled
# if caret is directly before/after the text field then pressing right/left key should move caret into widget's text field in the first/last position of the field's content. If the widget's content is larger then text field should be scrolled
# if caret is in the first/last position of the field's content then pressing left/right key moves caret to directly before/after the widget.  
# if caret is in the first/last position of the field's content then pressing left/right key moves caret to directly before/after the widget.  
# if caret is in the widget then pressing end/home key should move caret to
the last/first position of the field's content
# if caret is in the widget then pressing delete/backspace key can remove only field's content. If content is empty then nothing happens.
# if caret is in the widget then pressing delete/backspace key can remove only field's content. If content is empty then nothing happens.
# mouse click on text field moves focus to widget and moves caret on field's content. If mouse click is on the field but there is no content in this place then the caret moves to the last position of the content.
# mouse click on text field moves focus to widget and moves caret on field's content. If mouse click is on the field but there is no content in this place then the caret moves to the last position of the content.
# when the focus leaves the text field then onchange handler should be performed
# double click and click on text field should moves the focus to widget
# double click and click on text field should moves the focus to widget


===INPUT type="radio"===
===INPUT type="radio"===
# if the widget has focus then pressing space key sets the value of 'checked' attribute to 'true'
# double click and click on the widget moves focus to widget and sets the value of 'checked' attribute to 'true'  
# double click and click on the widget moves focus to widget and sets the value of 'checked' attribute to 'true'  
# if the widget has focus then pressing delete/backspace key the widget should be removed
# if the widget has focus then pressing delete/backspace key the widget should be removed


===INPUT type="checkbox"===
===INPUT type="checkbox"===
# if the widget has focus then pressing Space key sets the value of 'checked' to inverse value
# click on the widget moves focus to widget and sets the value of 'checked' attribute to inverse value
# double click and click on the widget moves focus to widget and sets the value of 'checked' attribute to inverse value
# double click on the widget moves focus to widget and sets the value of 'checked' attribute to inverse value twice (in fact the attribute doesn't change), i.e. action analogous to two single clicks is executed
# if the widget has focus then pressing Delete/Backspace key the widget should be removed
# if the widget has focus then pressing Delete/Backspace key the widget should be removed


Line 74: Line 62:
# widgets in selection should be copied, cut, pasted as part of the selection
# widgets in selection should be copied, cut, pasted as part of the selection


 
=== SPAN contentEditable='false' are contained in editable area===
=== SPAN editable='false' inside editable content===
All content of element SPAN with contentEditable='false' attribute is treated as a word. All elements and contols inside element have normal behaviour. Element is selected with all content as one element.
# span can be removed
# span can be removed by Backspace or Del keys.
# span can't have focus but widgets in span can have focus
# span can't have focus but widgets in span can have focus
# if span is inside selection and try to remove selection then content of the selection will be removed with span (see bullet 1)
# if span is in selection and try to remove selection then content of the selection will be removed with span (see bullet 1)
# span can't be copied into clipboard
# operations Undo can be applied for removed span
# span can is copied into clipboard
# if caret is directly before/after the span then pressing right/left key should move caret directly after/before span.  
# if caret is directly before/after the span then pressing right/left key should move caret directly after/before span.  
# when in multiline editable field Up/Down is pressed and in the next line under caret there is the span then caret should be moved to position directly before or after span (it depends on which place is closer).
# when in multiline editable field Up/Down is pressed and in the next line under caret there is the span then caret should be moved to position directly before or after span (it depends on which place is closer).
This behavior is actual for medical documents and other not fully structured documents.
'''Example''' of email letter.


==Bugs==
==Bugs==


Test on FF 3.5 Beta 2, Windows XP, Intel Atom
Tested on FF 3.5, 3.7 a1, Windows XP, Intel Atom


===SELECT===
===SELECT===


# SELECT widget doesn't handle any events. As the result there is no popup menu ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox.html|video]])
# SELECT widget doesn't handle any events. As the result there is no popup menu ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox.html video])
# if cursor is directly after SELECT widget and Left key is pressed then all typed text will appears inside the widget ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox1.html video]])
# if cursor is directly after SELECT widget and Left key is pressed then all typed text will appears inside the widget ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox1.html video])
# if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and in SPAN there is SELECT widget then it is possible to move caret into SELECT with keyboard ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox6.html video]]).  
# if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and in SPAN there is SELECT widget then it is possible to move caret into SELECT with keyboard ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox6.html video]).  


===BUTTON===
===BUTTON===
# if the caret is directly before/after the BUTTON widget then pressing delete/backspace key is editing the widget's content. If content is empty then widget is removed ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox2.html video]])
# if the caret is directly before/after the BUTTON widget then pressing delete/backspace key is editing the widget's content. If content is empty then widget is removed ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox2.html video])


===INPUT type="text"===
===INPUT type="text"===
# if to move the caret into text field with mouse and after then it is impossible to the field by pressing Right/Left keys. There is no problems to leave field if the caret is moved into field by pressing Right/Left keys  ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox3.html video]]).
# if to move the caret into text field with mouse and after then it is impossible to the field by pressing Right/Left keys. There is no problems to leave field if the caret is moved into field by pressing Right/Left keys  ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox3.html video]).


===INPUT type="checkbox"===
===INPUT type="checkbox"===
# widget doesn't handle any events. As the result it is impossible to change the valued of checked attribute ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox4.html video]])
# widget doesn't handle any events. As the result it is impossible to change the valued of checked attribute ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox4.html video])
# if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and in SPAN there is INPUT type=checkbox and the caret is directly after SPAN then caret disappears after pressing the Left key. The after next pressing Left key the caret will appears directly before SPAN  
# if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and in SPAN there is INPUT type=checkbox and the caret is directly after SPAN then caret disappears after pressing the Left key. After next pressing Left key the caret will appears directly before SPAN ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox7.html video])
([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox7.html video]])


===INPUT type="radio"===
===INPUT type="radio"===
# widget doesn't handle any events. As the result it is impossible to change widget's state  
# widget doesn't handle any events. As the result it is impossible to change widget's state ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox5.html  video])
([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox5.html  video]])


===TABLE===
===TABLE===
# if in the table's cell there is only one widget the there is no way to move caret into cell
# if in the table's cell there is only one widget the there is no way to move caret into cell


===Common===
===Common===
# if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and SPAN is not empty and the caret is directly before/after SPAN then the caret is appeared in non editable area after pressing Right/Left key. When caret returns back to editable area then it appears in the second position before/after SPAN ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox8.html video]])
# if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and SPAN is not empty and the caret is directly before/after SPAN then the caret is appeared in non editable area after pressing Right/Left key. When caret returns back to editable area then it appears in the second position before/after SPAN ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox8.html video])
# if in editable area there are 10-20 widgets then the significant performance degradation is occurred (tested on Intel Atom)
# if in editable area there are 10-20 widgets then the significant performance degradation is occurred (tested on Intel Atom)
# in selected area BUTTON and INPUT widgets are not visual selected ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox9.html video]])
# in selected area BUTTON and INPUT widgets are not visual selected ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox9.html video])
# visual selection is not cleared after selection for widget INPUT type=text
# visual selection is not cleared after selection for widget INPUT type=text ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox10.html video])
([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox10.html video]])
# it is impossible to copy to clipboard widget INPUT type=text and all text area before the widget ([http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox11.html video])
# it is impossible to copy to clipboard widget INPUT type=text and all text area before the widget ([[http://hgaid.ispvds.com/mozilla_editor_with_widgets/firefox11.html video]])

Latest revision as of 13:04, 16 November 2009

Problem

HTML5 introduced an ability to make entire HTML document or its part editable. However specification didn't provide complete documentation defining behaviour of HTML elements inside of editable area. Especially it concerns to HTML forms where the spec has few lines only. It leads to many things can be treated in different ways in question. So it's necessary to provide well-defined rules because this will allow to achieve compatibility between user agents. For example HTML form elements behaves differently in different versions of IE and Mozilla editor doesn't work well enough with them at all. So currently form elements are outsiders of editable world of HTML documents.

This article is designed to define behavior of editor used for editable HTML documents on user actions.

Application area

Now editor is used in HTML authoring tools. With using HTML form controls will be possible to develope:

  1. authoring tools for WYSIWYG development data entry forms. An example of the tool is Microsoft Office InfoPath.
  2. authoring tools for semistructured (loosely structured) forms. Semistructured forms can be constructed via HTML by placing XForms controls inside editable area. An example of application area of semistructured forms are clinical documents. Clinical document authoring tool can be used for developing clinical documents with providing easy-to-use interfaces.

The specification is corresponding with behavior of Microsoft Internet Explorer 6,7,8 and Microsoft Office InfoPath 2003.

Examples

  • Medical Document
  • Simple WYSIWYG XForms editors

Proposal

Widgets in containers with contentEditable attribute

The common approach - the behavior of widgets is the same with the HTML specification. But in HTML widgets are in the static place and in the editor widgets is a part of editing text, it is possible to cut, copy and paste widgets by clipboard.

Common behavior for all type of widgets in editable area

  1. if the caret is directly before/after the widget, then pressing right/left arrow key instead of next right/left caret's position to focus on the widget
  2. if the caret is directly before/after a widget then pressing of delete/backspace key is removing the widget
  3. if the widget has focus then pressing of delete/backspace key is removing the widget

SELECT

  1. if the widget has focus then pressing down/up key should change current value of widget's text field from widgets list. When the last/first list's value is achieved then the following pressing up/down key has no affects.
  2. mouse click on widget's text field should move focus to it and open widget's menu
  3. double click should open and close widget's menu, i.e. action analogous to two single clicks is executed

BUTTON

  1. if button has no focus then mouse click on button should move focus to button and execute onclick handler

INPUT type="text"

  1. if caret is directly before/after the text field then pressing right/left key should move caret into widget's text field in the first/last position of the field's content. If the widget's content is larger then text field should be scrolled
  2. if caret is in the first/last position of the field's content then pressing left/right key moves caret to directly before/after the widget.
  3. if caret is in the widget then pressing delete/backspace key can remove only field's content. If content is empty then nothing happens.
  4. mouse click on text field moves focus to widget and moves caret on field's content. If mouse click is on the field but there is no content in this place then the caret moves to the last position of the content.
  5. double click and click on text field should moves the focus to widget

INPUT type="radio"

  1. double click and click on the widget moves focus to widget and sets the value of 'checked' attribute to 'true'
  2. if the widget has focus then pressing delete/backspace key the widget should be removed

INPUT type="checkbox"

  1. click on the widget moves focus to widget and sets the value of 'checked' attribute to inverse value
  2. double click on the widget moves focus to widget and sets the value of 'checked' attribute to inverse value twice (in fact the attribute doesn't change), i.e. action analogous to two single clicks is executed
  3. if the widget has focus then pressing Delete/Backspace key the widget should be removed

Editor with widgets behavior

TABLE

  1. if in the cell there is only one widget then cell is considered to be with content (not empty)

TABBING

  1. tabbing behavior should be in consistent with tabbing preferences (accessibility.tabfocus). The tab key is pressed then focus moves to the next element independently where widget is (editable or not content)

SELECTION

  1. text and widgets can be selected with mouse or keyboard
  2. if widgets are into the selection then they should change visual presentation
  3. widgets in selection should be copied, cut, pasted as part of the selection

SPAN contentEditable='false' are contained in editable area

All content of element SPAN with contentEditable='false' attribute is treated as a word. All elements and contols inside element have normal behaviour. Element is selected with all content as one element.

  1. span can be removed by Backspace or Del keys.
  2. span can't have focus but widgets in span can have focus
  3. if span is in selection and try to remove selection then content of the selection will be removed with span (see bullet 1)
  4. operations Undo can be applied for removed span
  5. span can is copied into clipboard
  6. if caret is directly before/after the span then pressing right/left key should move caret directly after/before span.
  7. when in multiline editable field Up/Down is pressed and in the next line under caret there is the span then caret should be moved to position directly before or after span (it depends on which place is closer).

Bugs

Tested on FF 3.5, 3.7 a1, Windows XP, Intel Atom

SELECT

  1. SELECT widget doesn't handle any events. As the result there is no popup menu (video)
  2. if cursor is directly after SELECT widget and Left key is pressed then all typed text will appears inside the widget (video)
  3. if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and in SPAN there is SELECT widget then it is possible to move caret into SELECT with keyboard (video).

BUTTON

  1. if the caret is directly before/after the BUTTON widget then pressing delete/backspace key is editing the widget's content. If content is empty then widget is removed (video)

INPUT type="text"

  1. if to move the caret into text field with mouse and after then it is impossible to the field by pressing Right/Left keys. There is no problems to leave field if the caret is moved into field by pressing Right/Left keys (video).

INPUT type="checkbox"

  1. widget doesn't handle any events. As the result it is impossible to change the valued of checked attribute (video)
  2. if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and in SPAN there is INPUT type=checkbox and the caret is directly after SPAN then caret disappears after pressing the Left key. After next pressing Left key the caret will appears directly before SPAN (video)

INPUT type="radio"

  1. widget doesn't handle any events. As the result it is impossible to change widget's state (video)

TABLE

  1. if in the table's cell there is only one widget the there is no way to move caret into cell

Common

  1. if in the element DIV with contentEditable='true' there is SPAN with contentEditable='false' and SPAN is not empty and the caret is directly before/after SPAN then the caret is appeared in non editable area after pressing Right/Left key. When caret returns back to editable area then it appears in the second position before/after SPAN (video)
  2. if in editable area there are 10-20 widgets then the significant performance degradation is occurred (tested on Intel Atom)
  3. in selected area BUTTON and INPUT widgets are not visual selected (video)
  4. visual selection is not cleared after selection for widget INPUT type=text (video)
  5. it is impossible to copy to clipboard widget INPUT type=text and all text area before the widget (video)