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

removes between 1-6 layers of uneeded div nesting #240

Closed

Conversation

versecafe
Copy link
Contributor

Just a cleanup PR pulling out several dozen instances of uneeded excessive div nesting for styling by directly applying styles to components, makes dom faster to parse, bit easier for screen readers, and just easier to navigate through while debugging.

@versecafe versecafe self-assigned this Sep 1, 2024
</div>
<EditableH1
text={cell.text}
id={`cell-title-${cell.id}`}
Copy link
Contributor

Choose a reason for hiding this comment

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

cell-${cell.id} is used to target this element for scrollTo purposes, so I believe this change will break that behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

prior to this change there was multiple cell-${cell.id} instances which was doing weird things

Copy link
Contributor

Choose a reason for hiding this comment

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

the ids are unique so this shouldn't be problematic. What were the weird things that were happening?

@@ -29,7 +29,7 @@
</script>
</head>
<body>
<div id="root"></div>
<div id="root" class="flex flex-col"></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with most of these changes, but I prefer we have 0 styling in this file. It makes for a cleaner root and need to open less files when "looking for the rule".

I would add this back to the Layout

)}
</div>
<div
className={cn(
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't tried to refactor this yet but I suspect we can improve states here as well.

basicSetup={{ lineNumbers: false, foldGutter: false }}
/>
</div>
<CodeMirror
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm 50/50 on the readability improvement on this one. A surrounding div with only styles is easier to see than one of many props. Don't feel super strongly.

@@ -240,7 +238,7 @@ function Error(props: { error: string | null }) {
<div className="px-1.5 pb-1.5">
<div className="bg-error text-error-foreground text-sm font-medium py-2 pl-[10px] pr-3 flex items-start gap-1.5 rounded-sm">
<div className="shrink-0 mt-0.5">
<Info size={16} />
<Info size={16} className="shrink-0 mt-0.5" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we improve anything here? We should either remove the div around it or not do this?

Make sure to test this one, I'm not sure it's equivalent behavior (all for it if it is)

@benjreinhart
Copy link
Contributor

@versecafe should we close this for now given the large set of view changes in #267 ?

@versecafe versecafe closed this Sep 10, 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

Successfully merging this pull request may close these issues.

3 participants