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

Clicking the window tab with the middle mouse button opens up a new browser tab #60

Closed
filippsen opened this issue Aug 24, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@filippsen
Copy link
Contributor

filippsen commented Aug 24, 2018

Actual result

The window tab refers to the windows opened in the main editor area e.g. when opening a contract file for editing. Clicking HelloWorld.sol tab with the middle mouse button would cause a new browser tab to open with another instance of Studio.

Expected result

Nothing

@bashlund bashlund self-assigned this Aug 26, 2018
@bashlund bashlund removed their assignment Aug 28, 2018
@bashlund bashlund added the bug Something isn't working label Aug 28, 2018
@filippsen
Copy link
Contributor Author

There is currently no handler for middle-mouse button actions. Also, it relates to browser specific behavior. Given that, some "references" might consider this as "working as intended".

Adding a new event handler (for example onMouseDown) to renderHeader in src/components/projecteditor/panes.js makes it possible to read the middle-mouse button action, but it is not enough to prevent Chrome or Firefox from opening a new tab.

Reference:

<a href="#" className={classnames(cls)} onMouseDown={(e) => this.tabClickedMiddle(e)} onClick={(e) => this.tabClicked(e, pane.id)} onContextMenu={(e)   => this.tabRightClicked(e, pane.id)}>
tabClickedMiddle = (e) => {
    if(e.button == 1) {
        e.preventDefault();                                                                                                                                           
        e.stopPropagation();  // Important so we don't trigger tabClicked
    }   
}  

Unable to intercept action on the spot. Any ideas ? Is it relevant ?

@javier-tarazaga
Copy link
Contributor

@filippsen I think the reason might be with the fact that we are using instead of an actual button for clickable items. Have you seen this behavior in a component?

@filippsen
Copy link
Contributor Author

@javier-tarazaga The only other I place I spotted the same behavior is in the lightning/thunder icon (recompile or redeploy action, at the top left side of the respective windows). That one also happens to be an anchor element.

@filippsen
Copy link
Contributor Author

Complementing: removing the href="#" would solve the issue. However, it would require an addition to set the cursor pointer style back the way it was when the file tab was a link (on mouse over).

This was referenced Nov 12, 2018
@javier-tarazaga
Copy link
Contributor

Solved in #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants