Description#
Add a browser chrome (UI frame) above the web page viewport with an address bar, navigation buttons, and keyboard shortcuts. This transforms the project from a page viewer into an actual navigable browser.
Requirements#
Layout#
- Chrome bar rendered above the page viewport (not inside the web content)
- Address bar takes most of the width
- Navigation buttons (back, forward, reload) to the left of the address bar
- Chrome height: ~40px, with the page viewport filling the remaining window height
Address Bar#
- Displays the current page URL
- Clicking the address bar selects all text (for easy replacement)
- Typing a URL and pressing Enter navigates to that URL
- If input doesn't look like a URL (no scheme, no dots), treat as a search query (stretch goal — for now just prepend
https://) - Show loading indicator while page is loading (e.g., throbber or progress in address bar)
- Escape key cancels editing and restores the current URL
Navigation Buttons#
- Back (←) — go back one history entry (disabled when no back history)
- Forward (→) — go forward one history entry (disabled when no forward history)
- Reload (↻) — reload the current page; changes to stop (✕) while loading
Keyboard Shortcuts#
- Cmd+L — focus address bar and select all text
- Cmd+R — reload current page
- Cmd+[ — go back
- Cmd+] — go forward
- Escape (in address bar) — cancel and blur
Rendering#
- Chrome is rendered using the
textcrate for text andrendercrate for shapes - Chrome rendering is independent of web content (not affected by page CSS)
- Chrome redraws when URL changes, loading state changes, or buttons are clicked
Acceptance Criteria#
- Address bar displays the current URL and allows typing new URLs
- Pressing Enter in the address bar navigates to the typed URL
- Back/forward buttons navigate through history
- Buttons are visually disabled when navigation is not possible
- Reload button reloads the current page
- Cmd+L focuses the address bar
- Cmd+R reloads, Cmd+[/] navigate back/forward
- Chrome does not interfere with web page rendering or event handling