Strange issue with Google Chrome, Iframe and selected text, text direction became from LTR to RT

Viewed 280

In this example if input field is selected from right to left and mouse go over iframe and release click on the Iframe, then if cursor is on the iframe when I start typing into input field,text direction became RTL, when mouse cursor leaves Iframe it magically become LTR.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
    <div class="m-2">
        <div class="grid grid-cols-3">
            <div class="lg:col-span-2 w-full">
                <iframe class="w-full" height="960" src="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" style="border:0;"></iframe>
            </div>
            <div class="m-4 p-2">
                <div class="lg:col-span-1 w-full">
                    <div class="bg-white border rounded px-8 pt-6 pb-8 mb-4 flex flex-col">
                        <div class="flex justify-center font-bold text-sm">
                        Rename
                        </div>
                        <div class="mb-4">
                        <label class="block text-grey-800 text-sm mb-2" for="name">
                            Name
                        </label>
                        <input class="shadow border rounded w-full py-2 px-3 text-grey-800" type="text" value="Sample text">
                        </div>
                        <div class="flex items-center justify-end">
                            <button type="submit" class="bg-blue-500 hover:bg-blue-800 text-white text-sm font-bold py-2 px-4 rounded">
                              Submit
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

When I replace <div class="m-2"> with <div> the issue is solved. The question is why?? It's a Chrome bug?

Here a demo video of the bug: https://streamable.com/cdn1ni

0 Answers
Related