- Issue created by @bkosborne
@bkosborne What browser did you test in?
For me testing locally on latest 11.x dev:
- drush si standard -y
- drush en media_library
- Add image media field to basic page
- Create basic page, upload media image, save
- Edit basic page
- Remove selected media
On Windows, Chrome 131.0.6778.205, when I reload, the media selection is restored on the page. When I click the remove button again, the media item is correctly removed.
Also on Windows, Firefox 133.0.3, I can reproduce the issue mentioned in the IS. However, if I revisit the page (while on the page, click in location bar and hit enter) instead of reloading, then the remove button works as expected.
It seems to be related to Firefox keeping form data on reload: https://stackoverflow.com/questions/7377301/firefox-keeps-form-data-on-r.... It's an old issue on stackoverflow, but I can confirm that if I add the
autocomplete="off"
attribute to the node form, e.g.$form['#attributes']['autocomplete'] = 'off';
, then reloading on Firefox works the same as Chrome.- Merge request !10706Draft: Issue #3495881: Prevent browsers from retaining form build ID value. β (Open) created by godotislate
FWIW, making sure the form_build_id hidden input value does not get retained by the browser was enough to fix the issue for me on Firefox. I put up a draft MR 10706 with that change.
- πΊπΈUnited States bkosborne New Jersey, USA
It didn't occur to me to test in Chrome, thanks for that! I guess due the nature of the issue I didn't think it would be browser specific. Thanks for doing that and the MR! I'll test this next week and report back...