iFrame execCommand focus problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • appleseed
    New Member
    • Mar 2008
    • 1

    #1

    iFrame execCommand focus problem

    I'm having some problems on IE with a small editor I'm building. The source of the problem is the following:

    Consider having an iFrame with designMode="on" in which you select some text. When clicking anywhere in the page (outside de iframe), the iFrame looses focus and selection. However, this doesn't happen for images. When clicking on images the iFrame keeps its focus.

    So, all my toolbar buttons (Bold, Italic, OL, UL... s.o.) that have images behind, fire execCommand properly on the selection. However, the more complex options like ForeColor, FontName (which uses an absolute positioned <div> to popup and offer the choices), steel the focus when clicking on them. Therefor, when the actual execCommand fires, the iFrame has already lost the selection -> nothing happens.

    This only happens in IE. Firefox works just fine.

    Has anyone encountered something like this before? Are there any workarounds to prevent the iFrame from loosing focus and selection? Any other solution or opinion is most welcomed.

    Thanks a lot!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to the site!

    This example (using an iframe) seems to work.

    Comment

    Working...