Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix #5310 (Editor HTML menus are broken). #5311

Merged
merged 1 commit into from
Sep 24, 2013
Merged

Conversation

busykai
Copy link
Contributor

@busykai busykai commented Sep 23, 2013

Override the implementation of the jquery focus() to prevent HTML menus
(class "dropdown-toggle") grabbing the focus.

Bootstrap's dropdown implementation exlicitly calls focus() which causes
currently active CM instance to lose focus. As the result, when the
command is executed, it cannot get ahold of the current editor instance.

Override the implementation of the jquery focus() to prevent HTML menus
(class "dropdown-toggle") grabbing the focus.

Bootstrap's dropdown implementation exlicitly calls focus() which causes
currently active CM instance to lose focus. As the result, when the
command is executed, it cannot get ahold of the current editor instance.
@ghost ghost assigned RaymondLim Sep 24, 2013
@RaymondLim
Copy link
Contributor

@busykai Thanks for fixing this as we have Linux version that relies on HTML menus. I did verify that your changes fix most of the commands on Mac, Windows and Linux platforms with the exception of Cut, Copy and Paste still not working on Mac and Windows (which is an old issue that I had logged four months ago #3832).

@busykai
Copy link
Contributor Author

busykai commented Sep 24, 2013

@RaymondLim thanks for pointing that out. I was looking into Cut/Copy/Paste too and will come up with something. Do you think this is a reasonable solution for the rest?

@RaymondLim
Copy link
Contributor

Yes, I think your changes are safe to prevent the bootstrap code that steals the focus from the editor. So merging now.

RaymondLim added a commit that referenced this pull request Sep 24, 2013
Fix #5310 (Editor HTML menus are broken).
@RaymondLim RaymondLim merged commit 86207da into adobe:master Sep 24, 2013
@peterflynn
Copy link
Member

I wonder if this is the kind of case where we should feel free to directly patch the Bootstrap code? (Which is how Bootstrap was intended to be used, I think -- sort of as scaffolding rather than as a 'read-only' dependency). If all that's needed is commenting out one line of code in bootstrap-dropdown.js (line 58?), it'd definitely be simpler than the patch here...

@busykai
Copy link
Contributor Author

busykai commented Sep 25, 2013

It definitely might be a solution. I didn't want to go for it because I thought it would make brackets code more vulnerable to bootstrap upgrades. Over time there might be just too much things to remember about when moving from one bootstrap version to another (or any other library which may require adjustments). The suggested fix, on the contrary, just makes sure that bootstrap does not impact brackets behavior.

If bootstrap was included as a submodule, then it would make a patched version more sustainable -- there would be an explicit merge step when upgrading.

@peterflynn
Copy link
Member

Over time there might be just too much things to remember about when moving from one bootstrap version to another

Well, as long as we make the changes after initially dropping in a clean copy of Bootstrap, git diff can solve this problem for us :-)

In a sense, it might be more upgrade-fragile to have various Bootstrap-specific workarounds scattered around our codebase. The next time we upgrade, it won't be easy to go find all these and re-evaluate or remove them. (One thing that can help is to add a comment explicitly mentioning Bootstrap and citing the bug number, but unfortunately I didn't catch this PR soon enough to make that suggestion).

@busykai
Copy link
Contributor Author

busykai commented Sep 25, 2013

@peterflynn I will create a separate PR to amend it with an explicit comment, no problem.

@RaymondLim
Copy link
Contributor

@peterflynn I can go with either solution since each has its own pros and cons. Workarounds like this specific one should work for future updates to bootstrap even if we don't need it with the future updates that no longer steal away focus.

@busykai Thanks in advance for amending with an exlicit comment.

@peterflynn
Copy link
Member

@busykai Thanks, that sounds good! Looks like we might just be able to patch in a comment on our side since we needed to make another tweak to that code anyway: #5346.

busykai added a commit to busykai/brackets that referenced this pull request Sep 26, 2013
As per discussion in PR adobe#5311, related to issue adobe#5310.
@busykai
Copy link
Contributor Author

busykai commented Sep 26, 2013

@RaymondLim @peterflynn #5350 amends this PR. I didn't fix the return screw up (my bad :(). If the commit will be corrected in #5346, just close mine.

ingorichter added a commit that referenced this pull request Sep 26, 2013
Amend PR #5311 with an comment and issue ref.
peterflynn added a commit that referenced this pull request Sep 28, 2013
…eaks

* origin/master: (256 commits)
  Code review cleanups
  Expose code inspection providers for the extensions.
  Update to decompress-zip that includes fix for our issue.
  Code review: use more consts in Find; remove unneeded single-tickmark API
  hasNativeMenus param code cleanup
  code cleanup
  Less bright.
  First pass.
  When switching documents from QuickOpen, pop the modal bar out before switching and animate after
  Amend PR #5311 with an comment and issue ref.
  Return the result of calling the original jquery focus() function
  only need to handle closeOk and close events
  Add code to consistently delete the temporary extraction directory during install.
  Added .jsm extension for Mozilla JavaScript Module support
  API changes
  Change code to use temp package for temp file generation
  Change from "tmp" to "temp" for temporary stream creation
  Add console logging for unknown error.
  fix whitespace
  clear highlights and Find selection color when modal bar closes
  ...

Conflicts:
	src/styles/brackets_patterns_override.less
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants