Skip to content

[Fix] search icon vertical alignment in navigation bar#1016

Open
Flashl3opard wants to merge 4 commits intoalphaonelabs:mainfrom
Flashl3opard:fix/searchbtn
Open

[Fix] search icon vertical alignment in navigation bar#1016
Flashl3opard wants to merge 4 commits intoalphaonelabs:mainfrom
Flashl3opard:fix/searchbtn

Conversation

@Flashl3opard
Copy link

@Flashl3opard Flashl3opard commented Mar 10, 2026

Description

Fixed the vertical alignment of the search icon in both desktop and mobile navigation bars. The icon was previously using fixed positioning (top-2 and top-2.5) which didn't properly center it with the input field.

Changes:

  • Updated desktop search icon positioning from top-2 to top-1/2 -translate-y-1/2
  • Updated mobile search icon positioning from top-2.5 to top-1/2 -translate-y-1/2
  • This ensures the icon is perfectly centered regardless of input padding

Screenshots

Before

image

After

image

Checklist

  • Did you run the pre-commit? (If not, your PR will most likely not pass — please ensure it passes pre-commit)
  • Did you test the change? (Ensure you didn’t just prompt the AI and blindly commit — test the code and confirm it works)
  • Added screenshots to the PR description (if applicable)

This PR fixes the vertical alignment of the search icon in both desktop and mobile navigation bars by updating the CSS positioning and improves related accessibility attributes.

Key changes

  • Desktop: changed icon positioning from top-2 to top-1/2 -translate-y-1/2.
  • Mobile: changed icon positioning from top-2.5 to top-1/2 -translate-y-1/2.
  • Accessibility: added aria-label and title to the desktop search button and marked the visual icon element aria-hidden="true".

Technical details

  • Replaced fixed top offsets with the 50% + translateY(-50%) centering pattern so the icon stays vertically centered regardless of input padding.
  • Changes are limited to web/templates/base.html; no control flow or non-UI logic modified.

Impact

  • UX: Visual polish — search icons are consistently centered across viewports.
  • Accessibility: Added semantic labels for assistive tech while keeping decorative icons hidden from screen readers.
  • Scope: Visual/accessibility-only; no breaking changes. Pre-commit ran, manual testing performed, and before/after screenshots included.

Copilot AI review requested due to automatic review settings March 10, 2026 10:44
@github-actions github-actions bot added the files-changed: 1 PR changes 1 file label Mar 10, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'tools'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Replaced fixed top offsets on desktop and mobile search submit buttons with centered positioning (top-1/2 + -translate-y-1/2) and added accessibility attributes: aria-label, title on the desktop button and aria-hidden="true" on decorative icon elements in the base template.

Changes

Cohort / File(s) Summary
Template Styling & Accessibility
web/templates/base.html
Updated CSS utility classes on desktop and mobile search-submit buttons from fixed top-2/top-2.5 to top-1/2 with -translate-y-1/2 for vertical centering; added aria-label and title to the desktop submit button and aria-hidden="true" to decorative icon elements.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: fixing search icon vertical alignment in the navigation bar, which aligns with the core objective of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

👀 Peer Review Required

Hi @Flashl3opard! This pull request does not yet have a peer review.

Before this PR can be merged, please request a review from one of your peers:

  • Go to the PR page and click "Reviewers" on the right sidebar.
  • Select a team member or contributor to review your changes.
  • Once they approve, this reminder will be automatically removed.

Thank you for contributing! 🎉

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the vertical alignment of the search icon inside the desktop and mobile navigation search inputs by switching from fixed top-* offsets to centering via top-1/2 with -translate-y-1/2.

Changes:

  • Desktop navbar search icon: replace top-2 with top-1/2 -translate-y-1/2.
  • Mobile menu search icon: replace top-2.5 with top-1/2 -translate-y-1/2.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/templates/base.html`:
- Around line 351-353: The icon-only search submit buttons using the markup with
<button type="submit" class="absolute right-3 top-1/2 -translate-y-1/2
text-gray-500 dark:text-gray-300"> and the mobile variant that contains <i
class="fas fa-search"></i> need accessible names; add an aria-label (for example
aria-label="Search") to both button elements or include visually-hidden
descriptive text inside the buttons (e.g., a span with sr-only classes) so
screen readers announce a proper label instead of just “button”; update both the
desktop button and the mobile variant (the ones with the fa-search icon)
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d0090205-b435-4b54-ad75-1dcc0f4ad100

📥 Commits

Reviewing files that changed from the base of the PR and between c94caf8 and 75d4e01.

📒 Files selected for processing (1)
  • web/templates/base.html

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has 1 unresolved review conversation. Please resolve them before this PR can be merged.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
web/templates/base.html (1)

552-555: ⚠️ Potential issue | 🟡 Minor

Add an accessible name to the mobile search button.

This variant is still an icon-only submit button, so assistive tech will announce only “button”. Please mirror the desktop fix here and mark the icon as decorative as well.

♿ Suggested fix
                   <button type="submit"
-                          class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400">
-                    <i class="fas fa-search"></i>
+                          class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400"
+                          aria-label="Search courses"
+                          title="Search">
+                    <i class="fas fa-search" aria-hidden="true"></i>
                   </button>

As per coding guidelines, "Include proper ARIA labels where needed for accessibility."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/templates/base.html` around lines 552 - 555, The mobile icon-only submit
button (the <button> with classes "absolute right-3 top-1/2 -translate-y-1/2
text-gray-500 dark:text-gray-400") needs an accessible name and the icon marked
decorative; add an appropriate accessible label (e.g., aria-label="Search" or
visually-hidden text) to that <button> and mark the <i class="fas fa-search"> as
decorative (e.g., role="img" aria-hidden="true" or equivalent) to mirror the
desktop fix so screen readers announce the button properly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@web/templates/base.html`:
- Around line 552-555: The mobile icon-only submit button (the <button> with
classes "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500
dark:text-gray-400") needs an accessible name and the icon marked decorative;
add an appropriate accessible label (e.g., aria-label="Search" or
visually-hidden text) to that <button> and mark the <i class="fas fa-search"> as
decorative (e.g., role="img" aria-hidden="true" or equivalent) to mirror the
desktop fix so screen readers announce the button properly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 62788656-a333-4a49-86ad-950c0bb70b61

📥 Commits

Reviewing files that changed from the base of the PR and between 75d4e01 and 2b4437d.

📒 Files selected for processing (1)
  • web/templates/base.html

@github-actions github-actions bot dismissed their stale review March 10, 2026 14:14

All review conversations have been resolved.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/templates/base.html`:
- Around line 552-555: The nested Font Awesome <i> icon inside the search
<button> is decorative because the button already has an accessible name
(aria-label="Search courses"); update the <i> element (the icon with class "fas
fa-search") to be ignored by assistive tech by adding aria-hidden="true" so
screen readers don't announce the decorative icon.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 65f7ffed-39ff-4b29-a083-39ff8d84b78c

📥 Commits

Reviewing files that changed from the base of the PR and between 2b4437d and fe957bb.

📒 Files selected for processing (1)
  • web/templates/base.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 1 PR changes 1 file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants