Friday, April 18, 2008

Enable designMode, but cause IE double line break when pressing "Enter"

IE is sometime very innovation, but at one point you need to cry for bugging design.
IE came up first HTML editor (WYSIWYG) back to 5.x.

Eventually, Firefox (Mozilla) catch up this feature. And, it's in HTML 5 spec.
When you look at the Mozilla midas definition is very simple, but when you look at MSDN document that is very complicated and bloated. Mozilla implement most basic parts from IE and work perfect.
As security reason, the copy and paste are not scriptable in FF.

The line break is annoying in IE. Most of times, user experience double line break which is not user expected. To avoid double spaces, must use DIV tag as hint. If current cursor position's parent node is not DIV, then double line spaces which from P tag. This is part of developer know how.

Another interesting part is when you apply indentation (Indent), you can find out IE has DIV inside of BLOCKQUOTE. Obviously, the IE folks are trying to avoid double line break.

One time, I did handle key event to force all ENTER key BR tag. Unfortunately, it caused alignment problem. In IE, the alignment is applied to DIV, P, BLOCKQUOTE tag, but not between BR tags.

I am sure many peoples are fighting this issue. Despite, we can use SHIFT+ENTER to force as single line break, but who are going to know that.

No comments: