locked
Copying text in page controls

    Question

  • I have an HTML/JavaScript App that uses page controls. I would like users to be able to copy and paste the information that my app outputs. I recently asked this question before and got an answer I was pretty happy with which was to set an area to contenteditable="true". However, I recently found a problem with tablet users. The information displayed in the contenteditable area exceeds the height of the page so I have the overflow=”auto” style to allow scrolling. Whenever a tablet user touches this area in order to drag the content up it will open the keyboard since the contenteditable tag basically turns it into a textbox. This can be annoying if you have to exit the keyboard each time you scroll in order to read the content.

    Is there another way to allow for highlighting and copying text inside a page control layout? The news reader app that comes with windows 8 seems to have the same set up and I can copy text from it.


    tanner cypret

    Saturday, June 21, 2014 5:50 PM

Answers

  • Hi Tanner,

    Probably you should add your own logic for touch event, ref to this for more information: Quickstart: Manipulation gestures

    For instance when the system detect user action is scroll the div, disable the contenteditable and when there is only single touch received from user, enable that one.

    div.addEventListener("pointerdown", onPointerDown, false);
    div.addEventListener("MSGestureTap", onMSGestureTap, false);    
    div.addEventListener("MSGestureHold", onMSGestureHold, false);

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, June 23, 2014 6:47 AM
    Moderator