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

Feature: add focus to shell input when click anywhere #22

Closed

Conversation

nakamuraos
Copy link
Contributor

When click to shell, I want my mouse will focus to command input. This PR will add a function javascript to detect onclick (check not selecting text too).

@nakamuraos nakamuraos changed the title Added features: Click anywhere will focus to shell input Added feature: Click anywhere will focus to shell input Jan 7, 2021
@nakamuraos nakamuraos changed the title Added feature: Click anywhere will focus to shell input Feature: add focus to shell input when click anywhere Jan 11, 2021
Copy link
Owner

@flozz flozz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can you call your new function in the onload callback (replacing the eShellCmdInput.focus(); line) : https://github.com/flozz/p0wny-shell/blob/master/shell.php#L434

function focusShellCmd() {
var selection = window.getSelection();
if(!selection.toString()) {
document.getElementById('shell-cmd').focus();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to call getElementById() here, there is already a eShellCmdInput variable that contains this element

Copy link
Contributor Author

@nakamuraos nakamuraos Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The changes which you mention not correct. The code in this PR will execute every click, not only onload.

    <body onclick="focusShellCmd();">

@nakamuraos
Copy link
Contributor Author

Thanks @flozz for review my code.

I'll close this PR since it has already in #23

@nakamuraos nakamuraos closed this Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants