openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Re-enable autofill on add new book form

Open seabelis opened this issue 2 years ago • 10 comments

At some point it seems auto-fill was disabled on the title field of the add new book form. It's quite handy when adding books from a series that have similar titles with small variations. Please re-enable.

Evidence / Screenshot (if possible)

Relevant url?

https://openlibrary.org/books/add

Steps to Reproduce

  1. Go to ...the title field and start typing the title of a book already entered.
  2. Do ...notice there is no auto-fill activated.
  • Actual:no auto-fill
  • Expected: auto-fill should recognise previously entered text and populate the field

Details

  • Logged in (Y/N)?
  • Browser type/version?
  • Operating system?
  • Environment (prod/dev/local)? prod

Proposal & Constraints

Related files

Stakeholders

@jimchamp

seabelis avatar Dec 07 '23 15:12 seabelis

@seabelis can I please take on this issue? Thank you!

XiyueJasmineZhang avatar Dec 08 '23 06:12 XiyueJasmineZhang

@seabelis, so I understand, do you mean that the Browser's autofill feature (e.g. when google chrome suggests an autocomplete based on previous things you've entered) has been disabled for this page?

@XiyueJasmineZhang is this also your understanding of the problem? If so, can you share your proposed solution?

@cdrini tried to reproduce and is able to get browser autofill recommendations 🤔

mekarpeles avatar Dec 11 '23 20:12 mekarpeles

@XiyueJasmineZhang is this also your understanding of the problem? If so, can you share your proposed solution?

Hi! XiyueJasmineZhang is my school github account but I submitted the PR under this account. My understanding was that of the fields that needs to be filled on the Add a Book page: https://openlibrary.org/books/add, the "Title" field doesn't give autofill recommendations.

JasmineZhangxyz avatar Dec 11 '23 22:12 JasmineZhangxyz

@mekarpeles Yes. The publisher and date fields do auto-fill; the title field no longer auto-fills.

seabelis avatar Dec 14 '23 07:12 seabelis

Some more details:

  • Browser autofill for the title field is working as expected in Firefox
  • Autofill is confirmed broken in Chrome and Brave browsers.
    • Suspect that the same is true for all Chromium-based browsers.
    • Unsure about Safari (@mekarpeles, could you check?)
  • Changing the name attribute of the title input from title to title-field caused autofill to work again in Chrome.
    • Tested this by doing the following (with Chrome):
      1. Changed name attribute in my local instance.
      2. Added a book to my local instance.
      3. Loaded the production add book page.
      4. Modified the title input's name field using devtools. Auto fill worked after the name was changed.

As a quick fix, we could change the name of this field. Then, in the handler, set i.title equal to the new value here (this will prevent having to make a ton of changes throughout the add book flow). Whoever does this will have to make sure that the change doesn't break existing front-end validation on the title field.

jimchamp avatar Dec 14 '23 18:12 jimchamp

I would like to on this issue assign me!

btwshivam avatar Dec 24 '23 20:12 btwshivam

@shivam200446 are you still working on this?

jimchamp avatar Jan 04 '24 18:01 jimchamp

@jimchamp Yes Sir, Working on it. Please elaborate more on the issue. I am just being confused with all above conversations.

btwshivam avatar Jan 04 '24 18:01 btwshivam

Sure. In the future, please ask questions if you have doubts.

  1. Update the "Add book" template, here. Autofill is not working for inputs that have title as the name, so these will need to be updated. You can use book_title as the new name.
  2. The POST handler for the add book form is here. The expected form inputs and their default values are defined here. Add book_title="" to this object. Then, set the value of i.title to i.book_title.

jimchamp avatar Jan 04 '24 18:01 jimchamp

Sure. In the future, please ask questions if you have doubts.

  1. Update the "Add book" template, here. Autofill is not working for inputs that have title as the name, so these will need to be updated. You can use book_title as the new name.
  2. The POST handler for the add book form is here. The expected form inputs and their default values are defined here. Add book_title="" to this object. Then, set the value of i.title to i.book_title.

Okay! Thank You so much

btwshivam avatar Jan 04 '24 19:01 btwshivam