@ryuu-64/dsh-find-all 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9
4
+
5
+ - Reveal host-owned `hidden="until-found"` content before scrolling to a search match, instead of treating its layout geometry as proof that the match is visible.
6
+ - Wait for concealed matches to become visible before marking navigation as successful.
7
+
8
+ The supported host-version list is unchanged.
9
+
3
10
  ## 0.1.8
4
11
 
5
12
  - Keep Ctrl+F and the header search button bound to the current main conversation across sidebar focus changes and main-view navigation.
package/lib/client.js CHANGED
@@ -727,6 +727,16 @@ window.__ModuleLoader__.load({
727
727
  return null;
728
728
  }
729
729
 
730
+ function hiddenUntilFoundAncestor(node, root) {
731
+ var element = node && (node.nodeType === 1 ? node : node.parentElement);
732
+ for (; element && root && root.contains(element); element = element.parentElement) {
733
+ var hidden = element.getAttribute && element.getAttribute('hidden');
734
+ if (typeof hidden === 'string' && hidden.toLowerCase() === 'until-found') return element;
735
+ if (element === root) break;
736
+ }
737
+ return null;
738
+ }
739
+
730
740
  function captureReadingOrigin() {
731
741
  var target = state.target, viewport = readingViewport(target);
732
742
  var store = state.adapter && state.adapter.nodes(target);
@@ -850,13 +860,18 @@ window.__ModuleLoader__.load({
850
860
  if (token !== state.navigationToken || !originValid(origin)) return;
851
861
  var viewport = readingViewport(origin.target);
852
862
  var current = state.ranges[state.index];
853
- var geometry = current && origin.target.root.contains(current.startContainer) && rangeRect(current);
854
- if (current && !geometry) revealMatchRange(origin.target, current, activated);
863
+ var attached = current && origin.target.root.contains(current.startContainer);
864
+ // hidden=until-found uses content-visibility:hidden, so Chromium may
865
+ // report layout geometry for descendants that are not painted. Reveal
866
+ // the host-owned disclosure before trusting Range geometry.
867
+ var concealed = attached && hiddenUntilFoundAncestor(current.startContainer, origin.target.root);
868
+ var geometry = attached && !concealed && rangeRect(current);
869
+ if (current && (!geometry || concealed)) revealMatchRange(origin.target, current, activated);
855
870
  if (geometry && scrolledRange !== current) {
856
871
  scrollToRange(current);
857
872
  scrolledRange = current;
858
873
  }
859
- if (viewport && current && origin.target.root.contains(current.startContainer) && rangeRect(current, viewport)) {
874
+ if (viewport && attached && !concealed && rangeRect(current, viewport)) {
860
875
  var firstNavigation = !origin.navigated;
861
876
  origin.navigated = true;
862
877
  updateReturnButton();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuu-64/dsh-find-all",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Ctrl+F find bar for the DSH desktop app: it searches the whole conversation, not just the messages already on screen.",
5
5
  "type": "module",
6
6
  "license": "MIT",