Profile images disappear when using keyboard Enter/Return

AI-generated summary

Profile images disappear when using keyboard Enter/Return

A bug was reported by omarfilip where Profile Background and User Card Background images disappear when the Enter or Return key is pressed after editing user field data. The issue was reproduced in Chrome, Firefox, and Safari on Mac.

Steps to reproduce:

  1. Upload images to Profile Background and User Card Background
  2. Save changes with the Save button
  3. Press Enter or Return in any available user field

The solution was proposed by joffreyjaffeux in a GitHub pull request, which adds support for type="button" to the d-button component to prevent similar issues in the future. joffreyjaffeux recommended setting type="button" as the default for the d-button component, which was previously supported but not implemented.

The Profile Background and User Card Background images will disappear when Enter or Return are used after entering other user field data.

Reproduces on meta in Chrome, FF, Safari (Mac).

Steps to reproduce:

  1. Upload images to Profile Background and User Card Background at https://meta.discourse.org/u/username/preferences/profile
  2. Save with the Save button
  3. Place cursor in any available user field and press Enter or Return

At step #3 the Profile Background image will disappear. Press Enter again and the User Card Background will disappear. You now have to abandon your changes and reload to retrieve the images. If not, the user profile is saved without the image(s).

4 Likes

:wave: Thanks for the detailed repro, much appreciated :heart:

This should fix it, see commit description for details:

https://github.com/discourse/discourse/pull/8198

@sam @awesomerobot my recommendation would be to add the type="button" by default to d-button component, I added support for type months ago, and I think we should go further than this. It’s so easy to create this kind of unexpected behaviour.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.