Skip to content

Commit d1a375f

Browse files
authored
Merge pull request #1908 from oasisprotocol/lw/fix-highlight-gaps
Fix HighlightedText gaps in search results (parent style `gap: 3`)
2 parents 787ebc8 + 9a62fd8 commit d1a375f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.changelog/1908.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix HighlightedText gaps in search results (parent style `gap: 3`)

src/app/components/HighlightedText/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,19 @@ export const HighlightedText: FC<HighlightedTextProps> = ({
7777
const task = part ?? findTextMatch(text, [pattern], findOptions)
7878

7979
if (text === undefined) return undefined // Nothing to display
80-
if (task === NO_MATCH) return text // We don't have to highlight anything
80+
if (task === NO_MATCH) return <span>{text}</span> // We don't have to highlight anything
8181

8282
const beginning = text.substring(0, task.startPos)
8383
const focus = text.substring(task.startPos, task.endPos)
8484
const end = text.substring(task.endPos)
8585

8686
return (
87-
<>
87+
<span>
8888
{beginning}
8989
<Box component="mark" sx={sx}>
9090
{focus}
9191
</Box>
9292
{end}
93-
</>
93+
</span>
9494
)
9595
}

0 commit comments

Comments
 (0)