question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to cancel auto focus after initialization?

See original GitHub issue

Summary

Now that the TOAST UI Editor instance is created, it will automatically focus the browser on the editor, which will affect the user experience. This is not the case with the v2 version. How can I cancel the auto focus?

Screenshots

c0ef40d3-0eff-48f8-84fb-8a5ba3256dad

Version

3.0.1

Additional context

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />
    <style>
        #content {
            text-align: center;
            font-size: 10em;
            background-color: #eee;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <div id="content">1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/>10</div>
    <div id="editor"></div>
    <script src="https://uicdn.toast.com/editor/latest/toastui-editor-all.min.js"></script>
    <script>
        window.onload = function() {
            const editor = new toastui.Editor({
                el: document.querySelector('#editor'),
                previewStyle: 'vertical',
                height: '500px',
                initialValue: 'hello world'
            });
        }
    </script>
</body>
</html>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
js87zzcommented, Aug 5, 2021

@big-dream @ats1999 I checked it. I’ll think about how to fix this operation. It does look good to control as an option. Thank you!

2reactions
js87zzcommented, Sep 7, 2021

@big-dream The autofocus option has been added in v3.1.0. Thanks for @azmeuk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to stop EditText from gaining focus when an activity ...
Try clearFocus() instead of setSelected(false) . Every view in Android has both focusability and selectability, and I think that you want to ...
Read more >
SwiftUI default focus on TextField…
When the view is loaded, I want the soft keyboard to appear automatically so ... I tried initializing focus in the SwiftUI view's...
Read more >
Focusing: focus/blur
Please note that we can't “prevent losing focus” by calling event.preventDefault() in onblur , because onblur works after the element lost the ...
Read more >
How to set focus on input field automatically on page load ...
Create a directive “AutoFocus” that handles the auto-focus of input fields. In this directive set the HTML element as focused. Then import this ......
Read more >
Auto-focusing an Angular Input — The Easy Way? (Part 1)
You can call it “form-focus”. ng new form-focus. 2. Open the app.component.html and delete everything between the “div” with a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found