Skip to content

Open page feedback in a dialog from the API beta banner - #4867

Merged
akira28 merged 1 commit into
mainfrom
feature/api-beta-banner-feedback-modal
Nov 16, 2026
Merged

akira28 merged 1 commit into
mainfrom
feature/api-beta-banner-feedback-modal

Conversation

@akira28

@akira28 akira28 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The "let us know" link in the API beta banner now opens the page feedback widget in a dialog, instead of sending readers to a GitHub issue form. Where page feedback does not run, the link still goes to the issue form.

Affects: API reference, Site UI

Prompt summary: Reviewers asked that the beta banner reuse the feedback mechanism already on every API page, through a modal, instead of a link to a GitHub issue. This follows #4832, which added the banner.

Why

The banner points readers at a GitHub issue form. That asks for a GitHub account and sends the report to a different place than the thumbs-up and thumbs-down feedback on the same page. A reader who just noticed a problem has to leave the page to report it.

What

The link opens the feedback widget in a dialog

Where page feedback runs, "let us know" opens a dialog with the page's own feedback widget: Yes or No, then reasons, then an optional comment. It uses the api reasons and the same request and index as the widget at the bottom of the page, so no backend changes. Escape, the close button and a click on the backdrop close it. The widget sends the URL of the page the reader is on, also after moving between pages.

The issue form stays as the fallback

Where page feedback does not run, or the browser has no script or <dialog>, the link is a plain link to the issue form with the page URL filled in. A click with a modifier key opens that form in a new tab, as for any link. prod has no PAGE_FEEDBACK flag today, so it shows the plain link until the flag is on.

Both layouts

The dialog holds the design-system widget when NAVIGATION_PREVIEW is on and the <page-feedback> web component when it is off. ShowPageFeedback on GlobalLayoutViewModel replaces the rule that two feedback partials each repeated, and the banner reads it too. FeedbackModel takes an optional Id, so a second widget on a page does not share element ids with the first.

Out of scope: feedback from the dialog is not marked as coming from the banner. Telling it apart needs a new request field, an API mapping change and a new index version. Enabling PAGE_FEEDBACK for prod in config/assembler.yml is left to a separate change.

Verify

mise run test
# ApiBetaBannerTests — the banner with feedback off, air-gapped, on, and on with the design system
mise run site:test
# api-beta-banner.test.ts — opening, the fallbacks, backdrop close, and a banner that navigation replaces
FEATURE_PAGE_FEEDBACK=true mise run serve
# open an API page, click "let us know", move to another operation, and open it again

Check on the preview

  • Elasticsearch API overview — "let us know" opens a dialog with the feedback widget, and submitting works. Previews have PAGE_FEEDBACK on.
  • Elastic APIs catalog — the same dialog on the catalog page, which has no feedback widget at the bottom.
  • Docs home — control page: no banner.

🤖 Generated with Claude Code

The banner's "let us know" link sent readers to a GitHub issue form,
while every API page already has a feedback widget. Where page feedback
runs, the link now opens that widget in a dialog and keeps the page URL.
Elsewhere, and without script, it stays a link to the issue form.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@akira28
akira28 requested a review from a team as a code owner November 16, 2026 13:08
@akira28
akira28 requested a review from theletterf November 16, 2026 13:08
Comment on lines +22 to +29
@await RenderPartialAsync(_Feedback.Create(new FeedbackModel
{
PageUrl = Model.CurrentNavigationItem.Url,
PageTitle = Model.Title,
ApiBase = Model.FrontendConfig.ApiBasePath,
Surface = FeedbackSurface.Api,
Id = dialogId
}))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

Coordinate the two widgets' feedback state, not just their element IDs. Both implementations restore drafts using only the page URL, including the stored feedbackId. After a draft is restored, the dialog and bottom-of-page widgets therefore hold the same ID but independent state. Submitting details in one and then changing the reaction in the other sends a reaction-only PUT to that same ID, erasing the already-submitted reasons and comment. Share the controller/state between instances or give the dialog an independent draft and feedback identity.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +47 to 54
// A click on the backdrop lands on the dialog itself; the dialog has no padding, so nothing else does.
if (
target instanceof HTMLDialogElement &&
target.matches('.api-beta-feedback')
) {
target.close()
return
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

The backdrop check closes the dialog on any click whose target is the <dialog>. When a pointer goes down on one element and comes up on another, the browser fires click on their nearest common ancestor. So if a reader drags to select text in the comment textarea (or a reason label) and lets go past the edge of the dialog, the target is the dialog and it closes mid-task. To fix this, only close when the pointerdown also landed on the dialog itself, or compare the click coordinates against dialog.getBoundingClientRect().

Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +49 to +50
target instanceof HTMLDialogElement &&
target.matches('.api-beta-feedback')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

The backdrop-close behaviour finds the dialog by its styling class (.api-beta-feedback). The Site rules say JavaScript binds to data-* attributes and ARIA, never to styling classes, so that CSS can rename or restyle classes without touching behaviour. This file runs in the design-system bundle. If a theme or CSS refactor renames the class, clicking the backdrop silently stops closing the dialog. Bind it to a data attribute on the <dialog> instead, for example data-api-beta-feedback, as the opener already does with data-api-beta-feedback-open.

Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.

@github-actions

Copy link
Copy Markdown
Contributor

@akira28
akira28 merged commit 45cf7af into main Nov 16, 2026
48 of 49 checks passed
@akira28
akira28 deleted the feature/api-beta-banner-feedback-modal branch November 16, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants