Skip to content

fix: implement feedback #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

brettkolodny
Copy link
Collaborator

My trigger finger on mobile was too sensitive and I merged a PR without seeing the comments. Sorry @Parkreiner

Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2025 10:22pm

@brettkolodny
Copy link
Collaborator Author

Comments from This PR

Copy link

@Copilot 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 implements feedback from a previous code review that was merged prematurely. The changes focus on improving React component structure and key prop handling.

  • Replace <p> tags with semantically appropriate <span> elements for inline text
  • Update React keys to use more descriptive values instead of plain array indices
  • Add sorting to examples dropdown for consistent ordering

const href = `${window.location.origin}/parameters/example/${slug}`;
return (
<DropdownMenuItem
key={`${slug}-${index}`}
Copy link
Preview

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

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

Using index in the key after sorting may cause React reconciliation issues. Since slug appears to be unique, consider using just key={slug} instead of including the index.

Suggested change
key={`${slug}-${index}`}
key={slug}

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

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

The old code was right. index shouldn't be here

Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

A couple of things still need to be re-jiggered

@@ -98,7 +98,7 @@ export const Editor: FC<EditorProps> = ({
<DropdownMenuTrigger className="flex w-fit min-w-[140px] cursor-pointer items-center justify-between rounded-md border bg-surface-primary px-2 py-1.5 text-content-secondary transition-colors hover:text-content-primary data-[state=open]:text-content-primary">
<div className="flex items-center justify-center gap-2">
Copy link
Member

@Parkreiner Parkreiner Aug 1, 2025

Choose a reason for hiding this comment

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

We still need to check the generated HTML. If the trigger is producing a button, the resulting markup is going to fail to pass from an HTML validator
#50 (comment)

@@ -108,7 +108,7 @@ export const Editor: FC<EditorProps> = ({
{snippets.map(
({ name, label, icon: Icon, snippet }, index) => (
<DropdownMenuItem
key={index}
key={`${label}-${index}`}
Copy link
Member

Choose a reason for hiding this comment

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

index should be removed entirely

@@ -124,28 +124,33 @@ export const Editor: FC<EditorProps> = ({
<DropdownMenuTrigger className="flex w-fit min-w-[140px] cursor-pointer items-center justify-between rounded-md border bg-surface-primary px-2 py-1.5 text-content-secondary transition-colors hover:text-content-primary data-[state=open]:text-content-primary">
<div className="flex items-center justify-center gap-2">
Copy link
Member

@Parkreiner Parkreiner Aug 1, 2025

Choose a reason for hiding this comment

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

Same feedback here
#50 (comment)

})}
{Object.entries(examples)
.sort()
.map(([slug, title], index) => {
Copy link
Member

@Parkreiner Parkreiner Aug 1, 2025

Choose a reason for hiding this comment

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

Your code was right before. I'm curious to know why this was changed

const href = `${window.location.origin}/parameters/example/${slug}`;
return (
<DropdownMenuItem
key={`${slug}-${index}`}
Copy link
Member

Choose a reason for hiding this comment

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

The old code was right. index shouldn't be here

asChild={true}
>
<a href={href} target="_blank" rel="noreferrer">
<span className="sr-only">
Copy link
Member

Choose a reason for hiding this comment

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

This screen-reader comment should be placed after the title. Think about how the text would look like if we made everything visible:

(link opens in new tab) Attach GPU (random leading space included)

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