Skip to content

Commit cbf35e9

Browse files
committed
refactor: code review changes
1 parent 17755f7 commit cbf35e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/helpers/findAll.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { getConfig } from '../config';
33
import { isHiddenFromAccessibility } from './accessiblity';
44

55
interface FindAllOptions {
6+
/** Match elements hidden from accessibility */
67
includeHiddenElements?: boolean;
78

89
/** RTL-compatible alias to `includeHiddenElements` */
910
hidden?: boolean;
1011

1112
/* Exclude any ancestors of deepest matched elements even if they match the predicate */
12-
deepestOnly?: boolean;
13+
matchDeepestOnly?: boolean;
1314
}
1415

1516
export function findAll(
@@ -53,8 +54,8 @@ function findAllInternal(
5354
});
5455

5556
if (
56-
// Deepest only mode: add current element only if no descendants match
57-
(!options?.deepestOnly || matchingDescendants.length === 0) &&
57+
// When matchDeepestOnly = true: add current element only if no descendants match
58+
(!options?.matchDeepestOnly || matchingDescendants.length === 0) &&
5859
predicate(root)
5960
) {
6061
results.push(root);

0 commit comments

Comments
 (0)