You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Docs] Fix null-dereference, invalid DOM append, and redundant queries in hotkey.html - #1402
Adds a null check in focusSearchBar() to prevent a TypeError when .td-search__input is absent.
Removes searchElement.appendChild(searchKey), which attempted to append a child node to an <input> void element.
Removes automatic .focus() on DOMContentLoaded to preserve keyboard navigation and screen-reader focus.
Removes the empty <style> block and queries .td-search__input once instead of three times.
Moves the keyboard-css@1.2.4 stylesheet link from layouts/partials/hotkey.html (rendered in <footer>) into layouts/partials/head.html since .kbc-button classes are used across the navbar search button and Kanvas keyboard shortcut pages.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: e1d6da19-8c63-4bce-b02a-f02e05ca8518
Commits
Reviewing files that changed from the base of the PR and between b4dea09 and 7fd5367.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The head partial now includes keyboard-css 1.2.4. The hotkey partial checks for a search input before setting its placeholder or wiring the click handler. It removes automatic focus and moving the hotkey into the input.
Changes: Search hotkey handling
Layer / File(s)
Summary
Search field setup and hotkey behavior layouts/partials/head.html, layouts/partials/hotkey.html
The head partial adds the keyboard-css stylesheet link, and the hotkey partial removes its external stylesheet link. The focus helper checks for an input before focusing it. When an input exists, DOM-ready handling sets its placeholder to "Search" and wires the #searchKey click handler. Automatic focus and moving #searchKey into the input are removed.
The change fixes the possible null dereference in the search hotkey partial and removes the invalid append and the automatic focus on page load. It moves the keyboard stylesheet to the head partial. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: fixing a null dereference, an invalid DOM append, and redundant queries in hotkey.html. The raw summary and PR objectives confirm these fixes: a null guard in focusSea…
Linked Issues check
Issue #1401 has four coding requirements. Each is met at the reviewed head (b4dea09).
1. Null guard [#1401]: focusSearchBar(input) calls focus() only when input is truthy. The DOMContentLoaded handle…
Out of Scope Changes check
All changed code maps to #1401. The hotkey.html changes remove the defects and dead code that the issue lists. The head.html change (+1 line, keyboard-css link) implements the issue's stylesheet move.…
Full details: Title check
Explanation
The title names the main change: fixing a null dereference, an invalid DOM append, and redundant queries in hotkey.html. The raw summary and PR objectives confirm these fixes: a null guard in focusSearchBar(), removal of the append to the input, removal of auto-focus, and a single query for .td-search__input. The title's "[Docs]" prefix and the length (85 characters) are acceptable, though the title is long. It omits the stylesheet move, which is a secondary change.
Full details: Linked Issues check
Explanation
Issue #1401 has four coding requirements. Each is met at the reviewed head (b4dea09).
Null guard [#1401]: focusSearchBar(input) calls focus() only when input is truthy. The DOMContentLoaded handler returns early when .td-search__input is absent.
Invalid DOM append [#1401]: no appendChild call to the input remains in hotkey.html.
Focus steal [#1401]: no automatic focus runs on DOMContentLoaded. Focus runs only inside the #searchKey click listener.
Cleanup [#1401]: the empty <style> block is gone. .td-search__input is queried once. The keyboard-css@1.2.4 link moved from hotkey.html to head.html. This satisfies the issue's 'move or remove' option.
The head.html change was read directly in this assessment. It adds one stylesheet link line and no other change. The issue sets no test requirement, so no test gap applies.
Full details: Out of Scope Changes check
Explanation
All changed code maps to #1401. The hotkey.html changes remove the defects and dead code that the issue lists. The head.html change (+1 line, keyboard-css link) implements the issue's stylesheet move. The placeholder assignment is kept on the cached searchBar reference. The head.html diff shows no other changes, and no unrelated files were identified in the summary.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: eac7133c-5b9d-4d80-b31f-786eddab78ed
Commits
Reviewing files that changed from the base of the PR and between 62d99e7 and b4dea09.
Files selected for processing: 1
layouts/partials/hotkey.html
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup, and a good catch on all three bugs. The null check in focusSearchBar stops the TypeError on pages without a search input, removing the appendChild fixes an invalid DOM operation on a void input element, and dropping the automatic focus on DOMContentLoaded is the right call for keyboard and screen-reader users. Querying .td-search__input once instead of three times and moving the keyboard-css stylesheet into head.html, where it belongs now that .kbc-button is used across the navbar and Kanvas pages, tidy the partial up well.
Checks: DCO is green; CodeRabbit was still running when I reviewed. As a website-only change no code test coverage is needed.
One small tidy-up, left inline: the fallback query inside focusSearchBar is now unreachable, since the only caller always passes the element it already queried.
Thank you for the thorough review, @sarajkrishnasingh! Good catch on the unreachable fallback query in focusSearchBar — I've simplified the helper to accept and guard input directly in b4dea09. Ready for another look whenever you have a moment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing #1401, this cleans up hotkey.html nicely.
What looks good:
The null guard in focusSearchBar and the early return when .td-search__input is absent remove the TypeError on pages without a search input.
Removing the appendChild call fixes the invalid attempt to append a child to an input void element, and dropping the automatic focus on DOMContentLoaded preserves keyboard navigation and screen reader focus.
Querying .td-search__input once, removing the empty style block, and moving the keyboard-css stylesheet link into head.html are all sound cleanups. A stylesheet belongs in head, not in the footer partial.
Checks: DCO is green and CodeRabbit skipped with nothing to flag. No test coverage needed here since this is a docs site fix, and the change is confined to the two partials the issue names.
Thank you for contributing to the Layer5 community! 🎉 \ \ \ \ ⭐ Please leave a star on the project. 😄
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notes for Reviewers
This PR fixes #1401
focusSearchBar()to prevent aTypeErrorwhen.td-search__inputis absent.searchElement.appendChild(searchKey), which attempted to append a child node to an<input>void element..focus()onDOMContentLoadedto preserve keyboard navigation and screen-reader focus.<style>block and queries.td-search__inputonce instead of three times.keyboard-css@1.2.4stylesheet link fromlayouts/partials/hotkey.html(rendered in<footer>) intolayouts/partials/head.htmlsince.kbc-buttonclasses are used across the navbar search button and Kanvas keyboard shortcut pages.Signed commits
Summary by CodeRabbit