UIX: Cannot highlight text in a dashboard web application

Hi,

I have a dashboard using iframe to display my web application on a new right tab. I sometimes need to copy text from the application, but I can't even highlight any text at all. I've searched far and wide on the web, browsing forums searching for answers, that maybe it's the fact that these dashboards are running on IE11, or that maybe there are some settings to be adjusted in the dashboard.html file itself. Or maybe it's a CSS problem or something like that, but I couldn't find anything related to that problem, so I wanted to ask here.

Is this a known issue? Is there a way to be able to highlight and copy text from the iframe?

I can copy when I open my web app on any browser - even MS Edge in the IE11 view.

My web app uses both <span> and <p>. Everything is encapsulated in <div> tags.

Thanks for any help.

  • Hi, solution for me was to introduce contenteditable="true" to certain tags that I wanted to copy from and then, since contenteditable makes the whole tag actually editable by the user which I didn't want in JS, I disabled these events: "keydown, paste, drop, cut, contextmenu", to only enable copying and nothing else.

    $(document).on("keydown paste drop cut contextmenu", ".copyableContent", function(e) {
        e.preventDefault();
    });

    Old approach/Not a solution:

    I would also like to document a different approach that I actually did first, but it didn't work out for some reason. Maybe I'll take another look again later.

    At first I wanted to do something else. I looked at the code of metadatacard.html and metadatacard.js (and few more files) through the IE Chooser F12 application by Microsoft, which is basically an F12 for Internet Explorer, but as a separate application. There I checked some files and figured out that MFiles has it's own selection/highlighting behaviour and disables pretty much everything, except some specific classes and tags.

    Some example of those classes:
    "ui-allow-textselection" (with this class you can select)
    "mf-valuefield" (with this class you can select)
    "can-highlight" (actually doesn't really help much, but some things rely on it)

    Few more were found in the metadatacard.js file.
    Of course you can use input type textarea and text to edit/copy text, but the implementation would be weird imo.

    I tried to use these and then try to disable some M-Files behaviour by calling preventDefault, similar to my current approach, but I am thinking that maybe I did it in a wrong place (file of my application), or it's straight up impossible to disable this M-Files selection behaviour, because it's some code that you can't really "see" in your own dashboard app, but it's still applied.

    Anyway, hope this helps someone in the future.