Skip to content

Commit

Permalink
fix opening select boxes changing modal top location (#530)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Peveler <[email protected]>
  • Loading branch information
MasterOdin committed Nov 10, 2020
1 parent 2797748 commit b16a846
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
21 changes: 17 additions & 4 deletions vendor/renderer/semantic-ui/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# customized semantic-ui

This semantic-ui css has some customizations:
Sqlectron uses a slightly modified version of semantic-ui. These edits are relatively minor,
and allow it to play nicely with the react / local modal.

- Commented import of Lato fonts from Google because we use local fonts.
Any changes can be easily found by searching for `>>> SQLECTRON CHANGE`. The edits are specifically
listed below:

**IMPORTANT** In case of editing semantic-ui to bring in a new version (or otherwise), these changes
will have to be re-applied!

## JS

The semantic-ui js has some customizations:

**Important**
- observeChanges method ignores changes for "Select" class

In case updating semantic-ui this same changes should be applied again in the new file.
## CSS

This semantic-ui css has some customizations:

- Commented import of Lato fonts from Google because we use local fonts.
17 changes: 17 additions & 0 deletions vendor/renderer/semantic-ui/semantic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8372,6 +8372,23 @@ $.fn.modal = function(parameters) {
observeChanges: function() {
if('MutationObserver' in window) {
observer = new MutationObserver(function(mutations) {
/*
>>> SQLECTRON CHANGE: disable refreshing if changed element is "Select" class
The "Select" class is coming from React, and with how it functions, it injects
a component when the select is "opened". However, this triggers this function
with a DOM tree modified, and it attempts to "refresh" the modal, however, this
just messes up the `top` CSS for the modal with no benefit, so just ignore
refreshing instead.
*/
if (
mutations
&& mutations[0]
&& mutations[0].target
&& mutations[0].target.classList
&& mutations[0].target.classList.contains('Select')
) {
return;
}
module.debug('DOM tree modified, refreshing');
module.refresh();
});
Expand Down

0 comments on commit b16a846

Please sign in to comment.