Skip to content
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

Don't use react-dot-dot-dot for facets #75

Open
ChristopherChudzicki opened this issue Mar 15, 2024 · 0 comments
Open

Don't use react-dot-dot-dot for facets #75

ChristopherChudzicki opened this issue Mar 15, 2024 · 0 comments

Comments

@ChristopherChudzicki
Copy link
Contributor

Description/Context

Currently we use react-dot-dot-dot for facet text truncation. This has some downsides:

  1. A dependency / bundle size: Not a big deal really, since we use it elsewhere (e.g., for card titles in MIT Open and OCW).
  2. It doesn't seem to recalculate the truncation on window resize. (See screenshot below. Notice ... even though there's room for more text; the window was previously smaller, causing the truncation. You can see this in action at https://ocw.mit.edu/search, too.)
    Screenshot 2024-03-15 at 1 33 20 PM
  3. The HTML text is really truncated, not just visually. This affects screenreader labels.
    <div class="facet-label">
        <label for="department-15" class="facet-key">
            <div>Sloan School of Mana…</div>
        </label>
        <div class="facet-count">215</div>
    </div>

Plan/Design

IMO, it would be simpler to just use CSS text-overflow: ellipsis to truncate. That works well for single lines.

@gumaerc gumaerc self-assigned this May 13, 2024
@gumaerc gumaerc removed their assignment May 23, 2024
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

No branches or pull requests

2 participants