WikiEduDashboard icon indicating copy to clipboard operation
WikiEduDashboard copied to clipboard

Fix styling on <select> elements

Open ragesoss opened this issue 7 years ago • 28 comments

Using native <select> elements, as we do on many forms, makes it difficult to style the inputs. In particular, the dropdowns use the native browser / OS styling that can't be changed with CSS.

Where we use the react-select library, we have control over the styling, like this: styled dropdown

But for native elements, we get colors that don't match the rest of the system: unstyled dropdown

Probably the easiest solution will be to replace uses of plain <select> with react-select components.

ragesoss avatar Nov 30 '18 21:11 ragesoss

I would love to work on this! Could you please point me in the right direction? @ragesoss

shivanshbindal9 avatar Dec 12 '18 08:12 shivanshbindal9

It was supposed to be select rather than input. Whoops!

@shivanshbindal9 if you're already familiar with React, the outline of this task is something like:

  • Look at a component that already uses react-select, like MultiSelectField
  • Look at a component that uses plain select elements, like CourseTypeSelector
  • Replace select with the appropriately configured react-select Select component in that component, making sure that the input still updates as expected. This may require updating the onChange handler.
  • Submit a first PR to change just that one component, and once we see that it works smoothly, a subsequent PR can be done to update the rest of the cases of <select>.

ragesoss avatar Dec 13 '18 00:12 ragesoss

#2314 I tried to fix the issue for CourseTypeSelector! @ragesoss

shivanshbindal9 avatar Dec 13 '18 15:12 shivanshbindal9

Looks like the jest test for that will need to be updated. yarn test will run the javascript tests; you should take a look at the file for the failing test and see if you can update it for the implementation.

ragesoss avatar Dec 13 '18 17:12 ragesoss

#2314 I have added tests for Select in course_type_selector!! @ragesoss

shivanshbindal9 avatar Dec 18 '18 17:12 shivanshbindal9

#2331 I have added react-select in home_wiki_project_selector! @ragesoss

shivanshbindal9 avatar Dec 19 '18 19:12 shivanshbindal9

#2380 adds react-select in yes_no_selector!! @ragesoss Can you also please send me a slack invite . I would like to contribute to this project.

shivanshbindal9 avatar Jan 13 '19 19:01 shivanshbindal9

Sure! Send me an email to sage at wikiedu.org.

ragesoss avatar Jan 14 '19 21:01 ragesoss

#2410 addresses the issue that first option was selected even if any other option was selected. Also, can you please tell me other places where we need to change <select> to react-select .

shivanshbindal9 avatar Jan 23 '19 13:01 shivanshbindal9

@shivanshbindal9 I think pretty much everywhere that uses <select right now could potentially benefit from switching.

Many of the cases we have left are for table sorting, like in UploadsHandler, RevisionsHandler, ArticlesHandler, and AlertsHandler.

Others are more similar the ones you already did: CourseLevelSelector, HomeWikiLanguageSelector, and BlockTypeSelect.

ragesoss avatar Jan 23 '19 21:01 ragesoss

#2413 add react-select in home_wiki_language_selector. Also, do we need to change all the instances where we have used componentWillMount() ?

shivanshbindal9 avatar Jan 24 '19 09:01 shivanshbindal9

#2424 add react-select in block_type_selector.

shivanshbindal9 avatar Jan 26 '19 22:01 shivanshbindal9

@ragesoss can i work on this?

Arpitpundir avatar Jan 27 '19 05:01 Arpitpundir

@shivanshbindal9 eventually, yes, we'll need to replace all uses of componentWillMount. If it's part of the same component that you're updating for select, then it's find to combine that fix into the PR.

@Arpitpundir maybe better to work on a different issue, as Shivansh is working through the select elements already.

ragesoss avatar Jan 28 '19 18:01 ragesoss

@ragesoss I am not able to select the course level when creating a new course. Can you please help !! dbt

shivanshbindal9 avatar Jan 28 '19 21:01 shivanshbindal9

To get that selector, you need to have wiki_education: 'true' set in application.yml, so that you get the version of that form that is tailored to university courses.

ragesoss avatar Jan 29 '19 00:01 ragesoss

#2430 add react-select in course_level_selector !!

shivanshbindal9 avatar Jan 29 '19 13:01 shivanshbindal9

@ragesoss Sir, are there still any <select> elements remaining that need to replaced except for the ones left for table sorting ?

shivanshbindal9 avatar Feb 13 '19 19:02 shivanshbindal9

@ragesoss sir, sorry for not working on this for a long time as I had my university exams. Actually, when I am trying to use react-select for table sorting I am having some issues. Basically, when we use react-select various css components such as the dropdown icon, the input field all are wrapped inside div and it becomes difficult to remove them and add an image since there is a hierarchy of div .Also, I have gone through their documentation and couldn't find a similar use case. I'll be highly grateful if you could look into this and suggest some better method to implement the same.

shivanshbindal9 avatar Mar 07 '19 10:03 shivanshbindal9

@shivanshbindal9 interesting. It might not be possible with that library, I guess? I suggest opening an issue at react-select to describe what you're trying to do and ask if there's a way.

If not, it's not a big deal; the sort selector is the least noticable.

ragesoss avatar Mar 07 '19 22:03 ragesoss

Could you please assign me this task?

HARSHITHASALADI1 avatar Dec 12 '23 13:12 HARSHITHASALADI1

Can I work on this issue??

Priyanshu-su30 avatar Dec 29 '23 05:12 Priyanshu-su30

@Priyanshu-su30 sure, give it a try. A good way to begin might be to identify remaining select elements and add screenshots to show how they currently are styled, it looks like a few of them may have already been changed since the issue was opened.

ragesoss avatar Jan 02 '24 17:01 ragesoss

@ragesoss can u provide me the slack link I can't find it

Priyanshu-su30 avatar Jan 02 '24 18:01 Priyanshu-su30

@Priyanshu-su30 let me know your email address and I can send you an invite.

ragesoss avatar Jan 02 '24 18:01 ragesoss

@ragesoss Sure my email address is: [email protected]

Priyanshu-su30 avatar Jan 02 '24 18:01 Priyanshu-su30