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

Add an expand option for long sequence lists [...] #1699

Closed
Tracked by #1465
anna-parker opened this issue Apr 29, 2024 · 5 comments · Fixed by #1761
Closed
Tracked by #1465

Add an expand option for long sequence lists [...] #1699

anna-parker opened this issue Apr 29, 2024 · 5 comments · Fixed by #1761
Assignees
Labels
website Tasks related to the web application
Milestone

Comments

@anna-parker
Copy link
Contributor

As we at times have very long lists of substitutions it would be good to allow users the the option to expand or close the list of all mutations for a sequence.

@anna-parker anna-parker added the website Tasks related to the web application label Apr 29, 2024
@theosanderson
Copy link
Member

I think we should maybe do a couple of different things:

  • collapsing feature beyond a few lines of mutations
  • if the number of mutations is truly insane, many thousands: maybe we should just decline to show mutations at all and either display "[too many mutations to display]", or display nothing to avoid e.g. degrading people's browser performance

@theosanderson
Copy link
Member

As mentioned on Slack it would be nice to use hidden-until-found for all truncation

@chaoran-chen
Copy link
Member

React unfortunately doesn't support hidden-until-found, yet: facebook/react#24741

<div hidden="until-found"> gets translated to just <div hidden>.

@theosanderson
Copy link
Member

theosanderson commented Apr 30, 2024

Ah, we should be able to hack this with useRef and useEffect though I'd guess (manipulating the raw dom). I can try to make a wrapper component that does that

@theosanderson
Copy link
Member

theosanderson commented Apr 30, 2024

Hmm my experiments didn't work. Not sure why, but we can forget about this for now. For the record, my code:

import React, { useRef, useEffect, type ReactNode } from 'react';

interface HiddenUntilFoundProps {
  hidden: string; 
  children?: ReactNode;  
}

export const HiddenUntilFound: React.FC<HiddenUntilFoundProps> = ({hidden, children}) => {
  const elementRef = useRef<HTMLDivElement>(null);  // Specify that the ref will be attached to a div element
  
  useEffect(() => {
    if (elementRef.current) {
      elementRef.current.hidden = hidden;
    }
  }, [hidden]);

  return (
    <div ref={elementRef}>
      {children}
    </div>
  );
};
used as e.g. <HiddenUntilFound hidden="until-found">hello</HiddenUntilFound>

I can see that the DOM seems to get set up kind of correctly, but it doesn't work in the end. It seems like some more permanent hidden, which results in display:none gets added.

@chaoran-chen chaoran-chen self-assigned this May 1, 2024
@chaoran-chen chaoran-chen moved this to In Progress in Planning May 1, 2024
@chaoran-chen chaoran-chen added this to the MVP milestone May 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Planning May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
website Tasks related to the web application
Projects
Archived in project
3 participants