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

core/file block causes page to remain in "update" mode #60461

Closed
smetzdev opened this issue Apr 4, 2024 · 4 comments · Fixed by #60492
Closed

core/file block causes page to remain in "update" mode #60461

smetzdev opened this issue Apr 4, 2024 · 4 comments · Fixed by #60492
Assignees
Labels
[Block] File Affects the File Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@smetzdev
Copy link

smetzdev commented Apr 4, 2024

Description

When i use the file block on a page, it causes the "Update" button for the page to always be activated.
If i reload the page the "Do you really wan't to leave" Browser dialogue is shown.

This behaviour happens even if i haven't changed anything and ceases after i remove all core/file blocks

Step-by-step reproduction instructions

  1. Go to any Page in the editor
  2. Use the file block for a download
  3. Link a pdf
  4. Hide button and preview
  5. Hit update
  6. Refresh the page

Screenshots, screen recording, code snippet

Screen.Recording.2024-04-04.at.14.34.11.copy.mov

Environment info

WordPress Version 6.5
Frost Theme Version: 1.0.8
Core Gutenberg Version

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@smetzdev smetzdev added the [Type] Bug An existing feature does not function as intended label Apr 4, 2024
@Mamaduka Mamaduka added the [Block] File Affects the File Block label Apr 4, 2024
@Mamaduka
Copy link
Member

Mamaduka commented Apr 4, 2024

I can also reproduce the bug with the latest Gutenberg plugin. I believe it's due to the side effect that sets the downloadButtonText translatable default text.

@smetzdev smetzdev changed the title core/file block causes page to stay in "update" mode core/file block causes page to remain in "update" mode Apr 4, 2024
@talldan
Copy link
Contributor

talldan commented Apr 5, 2024

I can also reproduce the bug with the latest Gutenberg plugin. I believe it's due to the side effect that sets the downloadButtonText translatable default text.

The way that works seems a little unusual. If the user deletes the button text and saves, when they reload 'Download' comes back again.

I wonder if it'd be better to leave it empty in the editor, and only have 'Download' filled in as the default when empty on the frontend (e.g. via save.js or index.php). 🤔

@Mamaduka
Copy link
Member

Mamaduka commented Apr 5, 2024

You can't use save.js because a translatable string will break the block validation, and all strings should be translatable in the core.

I was thinking of using HTML API in index.php, but last time I checked, it couldn't replace text content for an HTML tag.

@talldan
Copy link
Contributor

talldan commented Apr 5, 2024

True, I forgot about that. Hopefully soon the HTML API will get that feature 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] File Affects the File Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants