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

Shortcuts make entering text impossible on mobile browsers #15224

Closed
tonyroberts opened this issue Apr 25, 2019 · 8 comments · Fixed by #16026
Closed

Shortcuts make entering text impossible on mobile browsers #15224

tonyroberts opened this issue Apr 25, 2019 · 8 comments · Fixed by #16026
Assignees
Labels
Bug A problem or regression with an existing feature ui Issues relating to the user interface
Projects
Milestone

Comments

@tonyroberts
Copy link

Describe the bug

When trying to type a SQL query in a mobile browser (specifically, Safari or Chrome on an iPad), the keyboard shortcuts always fire. For example, if you select the SQL editor and start typing ‘select’, the first ‘s’ brings up the settings menu.

To Reproduce

Steps to reproduce the behavior:

  1. Use the mobile versions of Safari or Chrome on an iPad
  2. Go to the SQL tab
  3. Select the query box
  4. Press ‘s’
  5. The settings window opens instead of putting an ‘s’ in the query box

Expected behavior

It should be possible to enter text into the SQL editor containing the letter ‘s’

Server configuration

  • Operating system: Linux
  • Web server: cpsrvd 11.78.0.21
  • Database version: libmysql - 5.1.73 / 5.6.41-84.1 - Percona Server (GPL), Release 84.1, Revision b308619
  • PHP version: 7.2.7
  • phpMyAdmin version: 4.8.3

Client configuration

  • Browser: Safari / Chrome
  • Operating system: iOS

Additional context

Perhaps an option to simply disable shortcuts in the settings would be an OK solution?

@williamdes
Copy link
Member

Seem to be a duplicate of #14711 but with a great description 😄

@williamdes williamdes added Bug A problem or regression with an existing feature ui Issues relating to the user interface labels Apr 25, 2019
@williamdes
Copy link
Member

williamdes commented Apr 25, 2019

Reproduced on chrome (Android), when typing multiple times 's' or 'S' in the sql query box

@JayEn84
Copy link
Contributor

JayEn84 commented Mar 11, 2020

I'm using the browser plugin "User Agent Switcher" in Firefox and Chrome on Windows. This enables me to test the mobile view of websites. Once I switch to a mobile browser with the plugin and open PHPMyAdmin, the keyboard shortcuts are active even after entering the SQL command textarea. Maybe this helps finding the bug.

@williamdes williamdes self-assigned this Mar 11, 2020
@JayEn84
Copy link
Contributor

JayEn84 commented Mar 11, 2020

I have examined the problem in more detail:

The file "shortcuts_handler.js" uses the following code to disable the keyboard shortcuts for some special circumstances:

if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT') {
    return;
}

This means, the keyboard shortcut functions won't fire if you press a shortcut key while inside an input, a textarea or a select element. And this works very well! However, the problem is that the SQL command "area" is not (always) a textarea. Under some circumstances it's a div with the attribute contenteditable=true, which then won't prevent the keyboard shortcut function from being executed.

I guess the above if statement should be extended in a way that also checks if the SQL command area is currently focused.

@williamdes
Copy link
Member

Thank you for the debugging @JayEn84 !
Let me know if you want to open a pull-request to fix this issue

@JayEn84
Copy link
Contributor

JayEn84 commented Mar 12, 2020

It's the first time I'm trying to do a pull request, and I'm not sure if I screwed up. :)

@williamdes williamdes added this to the 5.0.2 milestone Mar 12, 2020
@williamdes
Copy link
Member

It's the first time I'm trying to do a pull request, and I'm not sure if I screwed up. :)

Good first pull-request ;)

@williamdes
Copy link
Member

I could reproduce this issue using https://chrome.google.com/webstore/detail/user-agent-switcher/clddifkhlkcojbojppdojfeeikdkgiae and "Firefox on Android Mobile"

williamdes added a commit that referenced this issue Mar 19, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from to be fixed soon to Closed Mar 19, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature ui Issues relating to the user interface
Projects
issues
  
Closed
Development

Successfully merging a pull request may close this issue.

3 participants