-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix #9363: Code hints popup dismisses prematurely #9548
Conversation
Just to get the linkage: this is for #9363 |
@TomMalbran I can only get problem to reproduce in a slightly stricter version of @jasonsanjose's recipe:
I confirmed that you PR fixes this case. Is this what you are seeing, or is there another way to reproduce problem? |
@@ -4,12 +4,12 @@ | |||
<tr class="file-section" data-file-index="{{fileIndex}}"> | |||
{{#replace}}<td class="checkbox-column"><input type="checkbox" class="check-one-file" {{#isChecked}}checked="true"{{/isChecked}} /></td>{{/replace}} | |||
<td colspan="2"> | |||
<span class="disclosure-triangle expanded" title="{{Strings.FIND_IN_FILES_EXPAND_COLLAPSE}}"></span> | |||
<span class="disclosure-triangle {{#isCollapsed}}collapsed{{/isCollapsed}}{{^isCollapsed}}expanded{{/isCollapsed}}" title="{{Strings.FIND_IN_FILES_EXPAND_COLLAPSE}}"></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem necessary to have mutually exclusive expanded
and collapsed
classes since you can check for the presence versus absence of a single class.
I can only find a single place the collapsed
class is used in brackets.less:
.search-results .disclosure-triangle,
#problems-panel .disclosure-triangle {
.jstree-sprite;
display: inline-block;
&.expanded {
// Unfortunately, the way jsTree sprites are aligned within their 18px boxes doesn't look good in
// other contexts, so we need some tweaks here instead of straight multiples of @jstree-sprite-size
background-position: 7px 5px;
-webkit-transform: translateZ(0) rotate(90deg);
}
&.collapsed {
background-position: 7px 5px;
}
}
background-position
is the same for both cases, so this should be simplified to removes the reference to the collapsed
class:
.search-results .disclosure-triangle,
#problems-panel .disclosure-triangle {
.jstree-sprite;
display: inline-block;
background-position: 7px 5px;
&.expanded {
// Unfortunately, the way jsTree sprites are aligned within their 18px boxes doesn't look good in
// other contexts, so we need some tweaks here instead of straight multiples of @jstree-sprite-size
-webkit-transform: translateZ(0) rotate(90deg);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could and we can remove the toggle classes for the expanded class.
Done with review. |
@redmunds Yes. That is the way to reproduce it. The issue here is that the code hints pop up, then the search results list is re-rendered, and all the files are open. So to close them we are triggering a click event on every file which was previously collapsed. That then closes the code hints, since we triggered a click event. The fix is simply to just render the collapsed items as hidden so that we don't need to hide them later. |
@@ -160,7 +160,7 @@ | |||
/* Non-editor styling */ | |||
|
|||
.image-view, | |||
.not-editor { | |||
.not-editor.not-editor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This selector is for an element that has the not-editor
class applied twice -- that's not right is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be here. I was testing another bug and forgot to remove it, and didn't noticed it before committing.
BTW, is not for an element which has the class applied twice it works for any element that has that class, but by adding the class twice or more in a selector you increase the specificity of the selector, making the properties overwrite the ones applied in other selectors without using !important.
With latest code, I'm seeing this:
Results: Do you still need |
@redmunds I was able to reproduce that by:
At step 3 the file is removed from the list, and at step 4 the files is readded, but since the file was removed from the model, we lost the collapsed information so we don't know that is was collapsed before. If this is the only way to reproduce that bug, then it is a bug in master too and I don't think that is the same bug as #9363. So we should open a new issue for it and I can fix it in another PR, so that we can merge this one earlier. |
@TomMalbran I'm editing a simple HTML page. I do a Find in Files on just that page for "body". 2 instances found, and I collapse only node. Then I edit a tag other than body tag, Ctrl-S to save, and results are expanded. UPDATED: I'm seeing the same results in master, so I guess this is not related to this PR |
@redmunds I see. I was able to reproduce it now. But it is also a bug in master and it was not created in this PR. I think that the file is searched again and all the results are replaced, removing the state of isCollapsed. Do you think that we still need to fix it here? |
@TomMalbran No, that doesn't need to get fixed here. |
Thanks. Merging. |
Fix #9363: Code hints popup dismisses prematurely
@redmunds I tried to track the last issue you mentioned and I finally found it. When you save the file, the file system triggers a change event, and it deletes the entry from the search model. After that the file is searched again and readded, but the collapsed information was lost. I am thinking that maybe we should keep the collapsed state in a different object. |
…yet, select first result in this section With unit tests. - Quick Edit: Alt-Up/Down now skip collapsed sections (unless selection is in one, in which case the section is auto-expanded. With unit tests. - Remove ".collapsed" style from Quick Edit section headers since #9548 has removed it. Update unit tests to reflect this. - Make section header result counter font-weight: normal, not semibold - Tweak Quick Edit results list padding, per @larz0 - Fully remove defunct 'force' arg from sizeInlineWidgetToContents() - Docs tweaks for code review
I moved the logic to restore the collapsed files to the template, so that we don't need to toggle them after the results UI is rendered.