we (web engine): Experimental web browser project to understand the limits of Claude

Implement link click navigation #156

open opened by pierrelf.com

Description#

Clicking an <a href="..."> element should navigate the browser to the target URL. This is the most fundamental navigation feature — without it, the browser is a single-page viewer.

Requirements#

  • Hit-test mouse clicks against <a> elements in the render tree
  • Extract the href attribute from the clicked anchor element
  • Resolve relative URLs against the document's base URL (using the url crate)
  • Initiate a new page load via the ResourceLoader
  • Replace the current document in the browsing context with the newly loaded page
  • Re-run style resolution, layout, and paint for the new document
  • Handle target attribute basics: _self (default), _blank (ignore for now)
  • Support <a> elements wrapping block-level content (not just inline text)
  • Handle <area> elements inside <map> (stretch goal)

Acceptance Criteria#

  • Clicking a link on a rendered HTML page loads and displays the linked page
  • Relative URLs (e.g., href="/about") resolve correctly against the current page URL
  • Absolute URLs (e.g., href="https://example.com") work
  • Protocol-relative URLs (e.g., href="//example.com/page") work
  • Links with href="" reload the current page
  • Links with javascript: href are ignored (no crash)
  • Unit tests for URL resolution and click-to-navigate flow
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mii3n7lbdz2j