Skip to content

feat: add a "location autofilled" popover#76

Merged
MartinKolarik merged 7 commits intomasterfrom
target-probe-location
Jan 7, 2026
Merged

feat: add a "location autofilled" popover#76
MartinKolarik merged 7 commits intomasterfrom
target-probe-location

Conversation

@PavelKopecky
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 7, 2026

Walkthrough

Adds a styled autofill popover (gp-autofill-popover) in globalping.less. Introduces a locationAutofilled boolean on the page and binds it to the location-input component; the component uses this flag to show the autofill popover and set shouldPanelOpen to prevent the autocomplete panel while autofilled. Pages set locationAutofilled after probe fetch and programmatically focus/scroll the location input when prefilled. An e2e test was changed to simulate typed input (sequential key presses) instead of direct fill.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning No description was provided by the author, making it impossible to assess whether the rationale and context for the changes are documented. Add a pull request description explaining the purpose of the autofill popover, when it appears, and why this UX improvement was needed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly matches the main feature: a new UI popover that displays when a location is autofilled, with supporting styles and component logic added across multiple files.
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
  • Commit unit tests in branch target-probe-location

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0973fc3 and 65192fc.

📒 Files selected for processing (1)
  • src/views/components/location-input.html
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/views/components/location-input.html
🧰 Additional context used
🔍 Remote MCP DeepWiki

Summary — additional repo context relevant to reviewing PR #76 (location-autofill popover)

Key areas to verify (with sources)

  • SSR / hydration & @shared state

    • Ensure locationAutofilled and focus/select run client-only and are idempotent across SSR→CSR; see SSR/hydration flow, r-serialize and r-page hydration behavior, sections "Server-Side Rendering (SSR) Flow", "Data Serialization and Hydration", and "r-page onrender" ([Overview], [Data Serialization and Hydration], [Page Templates and SSR]).
  • Lifecycle safety (Ractive.isServer)

    • Any focus()/selection/DOM access must be guarded by !Ractive.isServer (render middleware & component lifecycle notes) — see "Component lifecycle" and SSR checks.
  • Autocomplete interaction

    • c-location-input behavior, indexing, shouldPanelOpen semantics, and keyboard/tab handling; confirm new shouldPanelOpen option aligns with existing Algolia/autocomplete patterns and tab/custom handling. See "Location Input / Autocomplete" and "Client-Side Routing" (historyProxy) for navigation interactions.
  • Accessibility & keyboard

    • Verify popover does not interfere with autocomplete keyboard navigation (Enter/Tab/Arrow). See autocomplete patterns, custom tab handling, and general keyboard patterns in select component.
  • Styling conventions

    • LESS naming, variables, dark popover theme, arrow, focus ring and inclusion in app.less so build picks it up; follow component LESS patterns (.gp- / c- prefixes, use of variables). See "Styling System" and "Component-Specific Styles".
  • Tests / e2e timing

    • E2E tests use Playwright and simulate typing sequences; updated test replaced fill() with typed key sequence — confirm autofocus/select/focus-within changes do not flakily alter Playwright timings. See "Testing and Linting" and "E2E tests" notes.
  • Suggested review checklist (apply to PR)

    • Lifecycle safety: focus/select guarded by !Ractive.isServer (SSR-only checks) — see SSR/hydration docs.
    • Hydration idempotence: locationAutofilled default and server initialization should not double-open popover or re-run focus on hydration.
    • Autocomplete contract: shouldPanelOpen must not break Algolia/autocomplete sources, custom tab handling, or results exposure. See location-input docs.
    • Keyboard & ARIA: ensure popover does not trap focus and is reachable/announced appropriately (check existing patterns for roles/aria in inputs/dropdowns). See accessibility patterns in input components.
    • Styles/build: add LESS into component/page pipeline (app.less import) so app.css includes .gp-autofill-popover; follow existing popover/tooltip styles and variables.
    • Tests: run Playwright e2e (noting typing sequence change) and watch for flakiness when autofill triggers focus/select; adjust test timing if needed.

Files/areas to inspect in PR (where to check implementation)

  • SSR/hydration behavior: r-serialize / r-page hydration logic (ensure guard usage)
  • c-location-input and autocomplete config (shouldPanelOpen / keyboard handling)
  • LESS styling conventions and inclusion in app.less / gulp build (nuxt:less if needed)
  • E2E tests (test/e2e/users.spec.js) with typing sequence — run Playwright locally/CI

Tools/sources used

  • Repository documentation index — DeepWiki_read_wiki_structure
  • Full repo docs and pages (SSR, components, styling, testing, build) — DeepWiki_read_wiki_contents
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run e2e tests
  • GitHub Check: Run e2e tests

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

Copy link
Copy Markdown

@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: 2

🤖 Fix all issues with AI agents
In @src/views/components/location-input.html:
- Around line 19-28: The popover element with class "popover top fade in
gp-autofill-popover" lacks ARIA semantics; update that div to include
role="status" and aria-live="polite" (optionally aria-atomic="true") so screen
readers will announce the autofill message when the popover appears; ensure you
add these attributes to the same element rendered by the location autofill
component so the message is announced without disrupting user focus.

In @src/views/pages/_index.html:
- Around line 2229-2244: Replace the fragile setTimeout-based autofocus/scroll
by observing the component state change that signals input readiness (the
swapInputs property) instead of the 10ms delay: when swapInputs becomes true and
location && !measurement, query '.location-input-hp .aa-Input', call
input.select(), compute a dynamic offset using the actual header element (e.g.,
query '.c-gp-header' and use header.offsetHeight with a small padding) and
scroll to input.getBoundingClientRect().top + window.scrollY minus that
header-derived value with smooth behavior; remove the hardcoded 225px and the
fixed setTimeout to ensure reliable timing and adaptable scrolling across
viewports.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc18678 and 2ed1077.

📒 Files selected for processing (3)
  • src/assets/less/pages/globalping.less
  • src/views/components/location-input.html
  • src/views/pages/_index.html
🧰 Additional context used
🔍 Remote MCP DeepWiki

Summary of Relevant Context for PR #76 Review

Based on the project documentation, here are the key facts and best practices relevant to reviewing this PR:

Popover Styling Best Practices

The project follows established patterns for popover styling:

  • Leverage Bootstrap base styles defined in popovers.less as the foundation, with custom overrides in common.less for specific designs
  • Use semantic class naming like the .gp-autofill-popover used in this PR
  • Implement responsive design by dynamically adjusting popover placement based on screen size
  • Custom popover styling should define position, z-index, display, max-width, padding, and box-shadow properties, which aligns with the changes in this PR

Location Input Component Patterns

The c-location-input component uses established patterns:

  • Built on Algolia Autocomplete for search capabilities
  • Normalizes probe data into searchable categories
  • Exposes results (raw probe objects) and completedValue (finalized query string) for observation
  • Supports complex query processing with filters

The PR's addition of a locationAutofilled state property aligns with this component's reactive architecture.

State Management Patterns

The codebase uses Ractive.js with these patterns:

  • Component-local state defined in data() functions returning initial property values
  • Reactivity through observers that respond to property changes
  • Computed properties for deriving values reactively
  • The PR correctly implements this pattern by adding locationAutofilled to the component's data() function with a default false value

Accessibility and Focus Management

Key practices to verify in this PR:

  • Visual focus indicators should use :focus or :focus-within pseudo-classes in LESS stylesheets (the PR uses :focus-within which aligns with best practices)
  • ARIA attributes like aria-expanded are used for dropdown states
  • Keyboard navigation should be supported for interactive elements
  • Screen reader accessibility through semantic HTML and .sr-only classes where needed

Important Review Considerations: The PR should ensure the autofill popover provides adequate visual feedback on focus and includes proper ARIA attributes for accessibility. The conditional panel opening logic (shouldPanelOpen) prevents suggestion conflicts while the autofill state is active, which follows the reactive data management patterns established in the project.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run e2e tests
  • GitHub Check: Run e2e tests

Comment thread src/views/components/location-input.html
Comment thread src/views/pages/_index.html
Copy link
Copy Markdown

@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

🤖 Fix all issues with AI agents
In @test/e2e/users.spec.js:
- Around line 40-41: The test is using autocomplete.clear() +
autocomplete.pressSequentially('Europe', { delay: 100 }) which is both slower
than necessary and inconsistent with the other test that uses
autocomplete.fill(''); change this to the consistent, faster approach by
replacing the clear()+pressSequentially sequence with
autocomplete.fill('Europe') where applicable, or if sequential key events are
required for behavior, reduce the delay to 10ms
(autocomplete.pressSequentially('Europe', { delay: 10 })) and keep a single
clear() only if needed; ensure the modified code mirrors the existing use of
autocomplete.fill('') used elsewhere to maintain consistency.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ed1077 and 0973fc3.

📒 Files selected for processing (1)
  • test/e2e/users.spec.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{vue,ts,js}

⚙️ CodeRabbit configuration file

We use Nuxt with auto imports enabled. Don't warn about missing imports.

Files:

  • test/e2e/users.spec.js
🧠 Learnings (1)
📓 Common learnings
Learnt from: PavelKopecky
Repo: jsdelivr/globalping.io PR: 76
File: src/views/pages/_index.html:2229-2244
Timestamp: 2026-01-07T14:29:45.200Z
Learning: For the location-input component (class `.location-input-hp`) in src/views/pages/_index.html, a 10ms setTimeout is sufficient to wait for the component's onrender to complete (swapInputs), and a fixed 225px scroll offset works reliably for positioning the input after autofill across the project's supported viewports.
🧬 Code graph analysis (1)
test/e2e/users.spec.js (1)
test/e2e/network.spec.js (1)
  • autocomplete (12-12)
🔍 Remote MCP DeepWiki

Summary of additional repository facts relevant to reviewing PR #76 (sources at end)

Key architecture & patterns that affect this change

  • Project uses Ractive.js SSR + client hydration; pages/components are server-rendered then hydrated — metadata and shared state are serialized via r-serialize and @shared (impacts lifecycle when introducing focus/auto-open behavior).
  • Styling: LESS compiled via Gulp; component styles live under src/assets/less and follow global conventions (use .gp_/.c- prefixes, focus rings via box-shadow, popover patterns exist). Versioned assets and long cache headers handled by server. New .gp-autofill-popover should follow existing popover and tooltip patterns (class decoration, focus styles).
  • Location input & autocomplete: c-location-input builds indexed probe data, supports complex queries, uses Algolia/autocomplete; it exposes results/completedValue and is keyed into app's behavior — changes to shouldPanelOpen and focus handling must not break existing autocomplete indexing or result exposure.
  • Component lifecycle: heavy reliance on Ractive lifecycle hooks (data(), oninit/onrender/oncomplete) and SSR-vs-CSR checks (Ractive.isServer). Any code that manipulates focus or DOM must be guarded for client-only execution and consider server serialization/hydration.

Accessibility, UX and integration considerations for this PR

  • Metadata & SSR/hydration: r-page removes server-rendered meta elements and recreates r-meta on client; similarly, server-rendered HTML that includes the location input + autofill state will be hydrated — ensure locationAutofilled and focus/select behavior are idempotent across SSR→CSR hydration.
  • Styling conventions: new gp-autofill-popover should follow existing popover/tooltip CSS (dark theme, arrow pseudo-element, box-shadow, focus ring) and be included in app.less so it appears in compiled app.css and in legacy .ractive-component prefix for Nuxt if needed.
  • Keyboard/ARIA: project emphasizes keyboard navigation for inputs and uses Algolia suggestions + history proxy — verify the popover doesn't interfere with keyboard handling (Enter/Tab/Arrow keys) and consider ARIA attributes (role="status"/role="dialog" or aria-live) consistent with existing dropdowns.
  • Tests: e2e tests use Playwright and simulate typing sequences (recent test change replaced fill() with typed key sequence). Ensure the new autofocus/select behavior and the updated typing test remain stable (timing/synthetic events can differ when input is focused/selected programmatically).

Concrete review checklist (apply when reviewing code)

  • Lifecycle safety: confirm focus/selection code runs only on client (guard Ractive.isServer) and does not depend on DOM during SSR.
  • Hydration idempotence: verify locationAutofilled default and server-side initialization align so hydration doesn't double-trigger popover open or focus.
  • Autocomplete interaction: ensure shouldPanelOpen logic respects c-location-input contracts (does not break Algolia panel behavior or results exposure).
  • Accessibility: check for aria attributes and keyboard behavior (panel opens/closes on focus/blur and keyboard navigation works).
  • Styling conformity: LESS class naming, use of existing variables, inclusion in build (app.less), and matching popover patterns (arrow, shadow, dark theme).
  • Tests: run affected Playwright e2e tests (noting typing sequence change) and verify the updated test flow passes with the new focus/selection logic.

Tools/sources used

  • DeepWiki_read_wiki_structure — repository doc index and pages list
  • DeepWiki_read_wiki_contents — architecture, styling system, component patterns, SSR/hydration, routing, build, testing, and specific input/autocomplete pages/components referenced above
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Run e2e tests
  • GitHub Check: build (24.x)
  • GitHub Check: Run e2e tests

Comment thread test/e2e/users.spec.js
@MartinKolarik MartinKolarik temporarily deployed to target-probe-location - globalping.io PR #76 January 7, 2026 14:43 — with Render Destroyed
@MartinKolarik MartinKolarik merged commit af140d4 into master Jan 7, 2026
4 checks passed
@MartinKolarik MartinKolarik deleted the target-probe-location branch January 7, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants