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

[CodeMirror] Autofocus Bug and suggestions #20228

Closed
Septdir opened this issue Apr 24, 2018 · 16 comments
Closed

[CodeMirror] Autofocus Bug and suggestions #20228

Septdir opened this issue Apr 24, 2018 · 16 comments

Comments

@Septdir
Copy link
Contributor

Septdir commented Apr 24, 2018

Bug

And once again it concerns two or more editors.

If there are two or more editors on the page, then focus all at once.

Actual result

3 editor focused together

Expected result

Only first editor focused

You can use this component for testing

Sentence.

In my opinion, autofocus option should be No by default

I'll explain why:

  1. It is not particularly correct that when I open the itemform immediately focus on the content
  2. If for some reason the editor does not fall into the field of view, then the page will be scrolled down to it.
@dgrammatiko
Copy link
Contributor

If there are two or more editors on the page, then focus all at once

Well I hardly see how multiple editors can get focus at the same time...

@brianteeman
Copy link
Contributor

magic

@Septdir
Copy link
Contributor Author

Septdir commented Apr 24, 2018

@dgrammatiko Like that
default

If you need this component. I'm doing it now, but you can test it.
https://github.com/JoomlaZen/com_jzpages
There are 3 editors in it. 2 of which codemirror if the plugin is enabled

Immediately say if you turn off autofocus then there is no problem

The case where two or more editors on one page is of course rare, but the bug is a bug

@dgrammatiko
Copy link
Contributor

Sorry but if you get both editors focused at the same time something is utterly wrong! Focus (and blur) are more than the visual indication eg, focused element is the one that tab key will leave to go to the next one. So even if you somehow hacked the visual part you totally destroyed the keyboard navigation (and probably a few more things)

@Septdir
Copy link
Contributor Author

Septdir commented Apr 24, 2018

@dgrammatiko

So even if you somehow hacked the visual part

I did not hacked anything. I just output 3 editors on one tab in my component(I need this). Output using standard code using xml and geInput function

Maybe here?
https://github.com/JoomlaZen/com_jzpages/blob/master/admin/views/page/tmpl/edit.php

or Maybe here?
https://github.com/JoomlaZen/com_jzpages/blob/master/admin/models/forms/page.xml

And if using this plugin does not work correctly, then this is a bug.

Or to output two editors in one tab Joomla breaking something? Personally, I have never read about this.

Moreover, I have never done this without the use of Joomla and there were no problems.

If the system allows you to output 2 editors on one page, then they should work correctly. Or not work at all.

@dgrammatiko
Copy link
Contributor

If the system allows you to output 2 editors on one page, then they should work correctly.

Define what is correct, because focusing simultaneously 2 elements in a page breaks the very fundamentals of the web: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus

@Septdir
Copy link
Contributor Author

Septdir commented Apr 24, 2018

@dgrammatiko Forgive or excuse probably I incorrectly expressed.

At me now the focus is established in 3 editions at once. And this is a bug.

It is necessary that in one.

Actual result

3 editor focused together

Expected result

Only first editor focused

@dgrammatiko
Copy link
Contributor

Ok now we're in the same page, that's a bug

@Septdir
Copy link
Contributor Author

Septdir commented Apr 24, 2018

@dgrammatiko Thank you. Sorry, I got a little excited. Just recently, joomla is very upsetting me in terms of bugs

@Quy
Copy link
Contributor

Quy commented Apr 24, 2018

@okonomiyaki3000 Your expertise please.

@okonomiyaki3000
Copy link
Contributor

Cool. So we should decide if we want to autofocus on the first editor or not at all. I'm slightly leaning toward not at all but I don't have a strong opinion on it.

@brianteeman
Copy link
Contributor

@Septdir
Copy link
Contributor Author

Septdir commented Apr 25, 2018

For the component from the example, it's best to be not at all So I support this position.

However, it turns out that in this case the plugin settings will be ignored.

By the way, maybe add autofocus to the xml attributes? Then the developer can adjust the focus himself and install it on the correct editor, or completely disable autofocus it in form.

This can be done in override. In my turn out to be very flexible

@grig0ry
Copy link
Contributor

grig0ry commented Apr 29, 2018

I agree with @Septdir. Adding autofocus to the xml attributes will be an excellent solution.

@joomla-cms-bot
Copy link

Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/20228

@ghost
Copy link

ghost commented May 1, 2018

closed as having Pull Request #20270.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants