Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bug: 3 inline then 1 out of line formats differently than Discord #509

Closed
1 task done
Chew opened this issue Nov 24, 2024 · 4 comments · Fixed by #511
Closed
1 task done

bug: 3 inline then 1 out of line formats differently than Discord #509

Chew opened this issue Nov 24, 2024 · 4 comments · Fixed by #511

Comments

@Chew
Copy link

Chew commented Nov 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

I seem to ran into a problem with inline rendering, at least on React.

Here's the code for what I have, for reference. https://github.com/Chew/ChewHelp/blob/master/src/components/mlb/PlanGameCommand.tsx

It renders mostly fine, see my docs.

CleanShot 2024-11-23 at 18 05 38@2x

But, it should look like this:

example

The bottom should span across the three, but only goes up to the first one and stops, causing some rendering issues.

It's very possible I broke something, I followed every guide I could to a tee!

Steps To Reproduce

  1. Make a new embed field wrapper with 3 inline fields and then 1 non-inline field
  2. Observe behavior

Expected behavior

I expected it to look like Discord, with the bottom field spanning all three.

Screenshots

No response

Additional context

No response

@favna
Copy link
Member

favna commented Nov 26, 2024

Start by removing inline={true} inlineIndex={1} from <DiscordEmbedField fieldTitle="📻 Listen" inline={true} inlineIndex={1}>. The field from your discord bot is also not inline.

I used devtools inspector to make that change on your docs and that fixes the whole embed:
-1732623870

@Chew
Copy link
Author

Chew commented Nov 26, 2024

Weird, doing that still has it wide, but I did remove like you said and it was fine:

After doing:

- <DiscordEmbedField fieldTitle="📻 Listen" inline={true} inlineIndex={1}>
+ <DiscordEmbedField fieldTitle="📻 Listen">

I get

CleanShot 2024-11-26 at 16 46 25@2x

It looks like an inline-index still lingers? There is no inline=true though, just the index.

CleanShot 2024-11-26 at 16 47 37@2x

If I explicitly set

- <DiscordEmbedField fieldTitle="📻 Listen" inline={true} inlineIndex={1}>
+ <DiscordEmbedField fieldTitle="📻 Listen" inlineIndex={undefined}>

Then it works fine with no editing. So it seems the bug is coming from it adding 1 for some reason?

favna added a commit that referenced this issue Nov 27, 2024
Fixes #509

Fix the issue with the bottom field not spanning across three inline fields in the embed.

* Update `packages/core/src/components/discord-embed-field/DiscordEmbedField.ts` to set the `inline-index` attribute only when `inline` is true.
* Add a check in `packages/core/src/components/discord-embed-field/DiscordEmbedField.ts` to ensure `inline-index` is not set when `inline` is false.
* Update the grid column span logic in `packages/core/src/components/discord-embed-fields/DiscordEmbedFields.ts` to correctly span the bottom field across all three columns when `inline` is not set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/skyra-project/discord-components/issues/509?shareId=XXXX-XXXX-XXXX-XXXX).
favna added a commit that referenced this issue Dec 1, 2024
Fixes #509

Fix the issue with the bottom field not spanning across three inline fields in the embed.

* Update `packages/core/src/components/discord-embed-field/DiscordEmbedField.ts` to set the `inline-index` attribute only when `inline` is true.
* Add a check in `packages/core/src/components/discord-embed-field/DiscordEmbedField.ts` to ensure `inline-index` is not set when `inline` is false.
* Update the grid column span logic in `packages/core/src/components/discord-embed-fields/DiscordEmbedFields.ts` to correctly span the bottom field across all three columns when `inline` is not set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/skyra-project/discord-components/issues/509?shareId=XXXX-XXXX-XXXX-XXXX).
@favna
Copy link
Member

favna commented Dec 1, 2024

Bizarre that it was setting it to 1, sure that is the default but that shouldn't apply unless inline=true I thought. At any rate, I changed the default to undefined in the above linked PR.

@favna favna closed this as completed in #511 Dec 1, 2024
favna added a commit that referenced this issue Dec 1, 2024
* fix: inline field bug in Discord embed

Fixes #509

Fix the issue with the bottom field not spanning across three inline fields in the embed.
@favna
Copy link
Member

favna commented Dec 1, 2024

Released in alpha 37

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants