Skip to content

Conversation

@ethanluc7
Copy link
Contributor

@ethanluc7 ethanluc7 commented Jan 19, 2026

Related to issue: #376

Summary

Refactored several things related to anchor tags, such as fixing schema level anchor tags not updating URL and anchor tags not showing up when hovering over the title text. Also added anchor functionality to field rows, where clicking or routing to to the URL scrolls to the specific field row and highlights it.

Description of Changes

  • Centralized scroll handling in DictionaryTableViewer - all hash parsing and scroll logic now lives in one place via parseHash() and handleHash()
  • Added Schema-name based URLs - anchors now use readable names (#schemaName, #schemaName.fieldName) instead of numeric indices
  • Field-level anchors - added clickable hash icons to individual fields in Fields.tsx for direct linking
  • Added highlight animation - fields pulse with accent color when navigated to via anchor link
  • Simplified TableOfContentsDropdown - removed direct hash/scroll manipulation, now just calls onSelect() callback
  • Fixed hover styles in AccordionItem - moved hover selectors to row level for proper sibling targeting

Readiness Checklist

  • Self Review
    • I have performed a self review of code
    • I have run the application locally and manually tested the feature
    • I have checked all updates to correct typos and misspellings
  • Formatting
    • Code follows the project style guide
    • Autmated code formatters (ie. Prettier) have been run
  • Local Testing
    • Successfully built all packages locally
    • Successfully ran all test suites, all unit and integration tests pass
  • Updated Tests
    • Unit and integration tests have been added that describe the bug that was fixed or the features that were added
  • Documentation
    • All new environment variables added to .env.schema file and documented in the README
    • All changes to server HTTP endpoints have open-api documentation
    • All new functions exported from their module have TSDoc comment documentation

@ethanluc7 ethanluc7 requested a review from JamesTLopez January 19, 2026 19:48
Comment on lines +163 to +165
const newUrl = `${window.location.pathname}${window.location.search}${windowLocationHash}`;
window.history.pushState(null, '', newUrl);
window.dispatchEvent(new HashChangeEvent('hashchange'));
Copy link
Member

Choose a reason for hiding this comment

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

y'all may disagree, but this seems like something that should be handled using React Router, not "manually" with the History API.

thoughts @joneubank, @mistryrn?

Choose a reason for hiding this comment

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

Hard to say as I don't have full context into this project, but ideally I think these would just be plain old anchor tags and we'd take advantage of built-in browser behaviour to achieve the desired functionality.

Does anyone know if there's a reason the team chose to use a button element instead of an anchor on line 198 of AccordionItem.tsx? I see there's something going on with setting clipboard contents as well, maybe that's why.

Again, I lack the full context of this feature/project, so I may just be missing something.

Assuming there is a reason why we're using a button here: I agree that using React Router would be the recommended approach. But I see that this project isn't importing or using React Router at all, so maybe that's why they're doing it "manually"? If there's no application state concerns or re-render concerns, maybe using the History API is fine here versus importing and setting up React Router for just this?

Copy link

@JamesTLopez JamesTLopez Jan 20, 2026

Choose a reason for hiding this comment

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

button element instead of an anchor on line 198 of AccordionItem.tsx? I see there's something going on with setting clipboard contents as well, maybe that's why.

I think you are correct on this assumption, looks like originally it was just clip-boarding. Now its updating the url and clip-boarding.

I think React Router would good to add here as we would be using the React Router in the future.
We are doing work with ERD implementation soon which will require us to implement navigation and would possibly require us to make more customizations onClick beside just navigating(kinda like whats happening with the clipboard).

So it wouldn't be a bad idea to start using something more inline with the React Paradigm than the history api here.

Open to suggestions and insight.

<TableRow key={row.id} row={row} index={i} />
))}
{table.getRowModel().rows.map((row, i: number) => {
const fieldName = (row.original as { name?: string })?.name;
Copy link

@JamesTLopez JamesTLopez Jan 20, 2026

Choose a reason for hiding this comment

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

Can you type this without casting? As a general rule of thumb, we want to avoid as type casting.
Possibly type guard is needed: https://www.typescriptlang.org/docs/handbook/advanced-types.html

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.

5 participants