Skip to content

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Nov 1, 2024

Summary

Reduced the JavaScript bundle size. By optimizing the implementation of core component code, overall JavaScript sizes are reduced.

Breaking change

This is not a breaking change.

Related pull requests

Split from #5793, to simplify review.

Preview link

N/A

Problem statement

See #5793

Solution

Replace use of receptor/ignore with equivalent Node#contains condition.

The intended purpose is the same.

receptor.ignore:

Returns a delegated function that only calls the callback if the event's target isn't contained by the provided element. This is useful for creating event handlers that only fire if the user interacts with something outside of a given UI element.

Node#contains

The contains() method of the Node interface returns a boolean value indicating whether a node is a descendant of a given node, that is the node itself, one of its direct children (childNodes), one of the children's direct children, and so on.

Testing and review

To be totally honest, I'm not sure what this behavior is meant to control. References to js-search-button CSS class do not appear in any relevant Storybook stories or documentation.

@mahoneycm
Copy link
Contributor

Looking into it, it looks like this might be a relic of the old components structure? Here's a link to the components dir from the release-2.14.0 branch.

I also can't find where this JS file is being used at all. This looks like a suitable replacement but I'm curious if we should just remove from this version of USWDS since it's not being used by the design system.

@amyleadem @mejiaj Any thoughts? Should we upkeep despite this or is it just tech debt?

@mejiaj mejiaj changed the base branch from develop to replace-receptor January 14, 2025 14:11
@mejiaj mejiaj requested a review from a team as a code owner January 14, 2025 14:11
@dct2023
Copy link

dct2023 commented Feb 7, 2025

@mlloydbixal Adding you as a reviewer for this to get us unblocked on #6291

@dct2023 dct2023 assigned mandylloyd and unassigned mahoneycm Feb 7, 2025
Copy link
Contributor

@heymatthenry heymatthenry left a comment

Choose a reason for hiding this comment

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

Approving as-is so help move the other related PRs (#6174, #6175) along rather than chasing down anywhere else ignore may have been used historically.

@heymatthenry heymatthenry merged commit 584633e into uswds:replace-receptor Jun 9, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from Peer Review to Fed Final Review in USWDS Core Project Data Jun 9, 2025
@heymatthenry heymatthenry mentioned this pull request Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Fed Final Review
Development

Successfully merging this pull request may close these issues.

6 participants