Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contenteditable div not work with scrollable content #421

Closed
xuyuanme opened this issue Jan 15, 2014 · 10 comments
Closed

contenteditable div not work with scrollable content #421

xuyuanme opened this issue Jan 15, 2014 · 10 comments
Assignees

Comments

@xuyuanme
Copy link

I tried to use ionic to implement an editable html notepad like iPhone's build-in "Notes" app. The following code works fine on Windows Chrome, but having issue on iPhone(iOS 6 and 7) Safari/Chrome:

<content has-header="true" has-footer="true" scroll="true">
    <div contenteditable="true"
         style="-webkit-user-select: auto; -moz-user-select: auto; -ms-user-select: auto; user-select: auto;">
        <div>1. some note that should be editable</div>
        <div>2. some note that should be editable</div>
        <div>3. some note that should be editable</div>
        <div>4. some note that should be editable</div>
        <div>5. some note that should be editable</div>
    </div>
</content>

On iPhone the contenteditable div is very hard to be clicked to edit (it seems only a small area of the first note is responding). Setting scroll="false" will resolve this issue. [Edit]: Actually setting overflow-scroll="true" resolves the issue.

Here's an online example of the issue: https://notegg.com/uitest

@xuyuanme
Copy link
Author

The issue is with the following code in ionic.js:

      container.addEventListener("touchstart", function(e) {
        // Don't react if initial down happens on a form element
        if (e.target.tagName.match(/input|textarea|select/i)) {
          return;
        }

        self.doTouchStart(e.touches, e.timeStamp);
        e.preventDefault();
      }, false);

It does not recognize a "tap" on the div. Instead, e.preventDefault() get called in "touchstart" event. Maybe remember the tap action and re-trigger it again after touchend event will help?

Another similar issue is, for multi-line textarea inside the content area, only first tap works.

@mlynch
Copy link
Contributor

mlynch commented Jan 16, 2014

Thanks for the data, that really helps! We'll take a look at it.

@ghost ghost assigned mlynch Jan 17, 2014
@adamdbradley adamdbradley assigned ajoslin and unassigned mlynch Feb 3, 2014
@adamdbradley adamdbradley modified the milestones: 0.9.25, 1.0 Beta Feb 3, 2014
@mlegenhausen
Copy link
Contributor

+1

@yeradis
Copy link

yeradis commented Feb 9, 2014

this is affecting the scroll on form views

@calendee
Copy link

@ajoslin Can you re-open this please?

Forum : http://forum.ionicframework.com/t/contenteditable-on-side-menu-does-not-work/3195

Working Sample : contenteditable works properly with no side-menu : http://codepen.io/calendee/pen/jeLoA/

Good / Bad Sample : http://codepen.io/calendee/pen/nuHph : contenteditable works properly INSIDE the side-menu. Open the side menu and edit the "Edit Me!" section. It works properly. Now, try to edit the "Edit This In The Main Content" section. It cannot be edited. NOW : Switch to another browser tab. Then go back to this sample. The contenteditable div has the cursor and can be edited.

@ajoslin ajoslin reopened this Apr 21, 2014
@ajoslin
Copy link
Contributor

ajoslin commented Apr 29, 2014

@calendee Could you test this again with beta2 and the recent scroll changes?

I don't understand the codepen you posted.

@calendee
Copy link

Still not working Andy on nightly or beta2.

Open the CodePen. Welcome page shows "EDIT THIS SECTION!!!!" Try to edit it. No dice. It should be editable.

If you open the menu, you will see "Edit Me!" as a list item. You can edit it like a fiend.

@adamdbradley adamdbradley assigned adamdbradley and unassigned ajoslin Apr 30, 2014
@adamdbradley
Copy link
Contributor

@ajoslin I'll look into this one since it's related to all the tap/scroll stuff.

@adamdbradley adamdbradley removed this from the 0.9.25 milestone May 14, 2014
@yankustefan
Copy link

Hi

Its seems that for ionic-v1.0.0-beta.9 the issue is still persisting.

Also the issue described here:
http://forum.ionicframework.com/t/contenteditable-div-disappears-while-loosing-focus/4201/4
and:
#1897

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants