question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select & context menu improvements

See original GitHub issue
  • options are currently specified as { value: string, option?: string }. Actually, options are treated in the code as always specified, and there are runtime errors when they are omitted.
  • we should consider removing options altogether, and have the component simply take a list of strings. This would make the component much easier to use, and leave the minimal responsibility of mapping the labels to raw values to the library user. If need be, they can produce a wrapper that restores the current API with very minimal code.
  • a redesign to match DatePicker is in order, adding a minimum width to look good.
  • when the values pop up, their design should match ContextMenu.
  • redesign the label to be consistent with input and date picker.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
TejasQcommented, Apr 6, 2018

I favor number 1 because it seems like better design and will provide two very well thought through, robust components to serve both purposes of Select and ContextMenu.

I favor number 2 because it delegates the power to ContextMenu, while allowing for something simpler if needed.

I favor both approaches and your engineering skills and literally cannot decide. Sorry I’m not much help, but if it was up to me, I’d say do whatever seems best to you. ¯\_(ツ)_/¯

1reaction
peterszerzocommented, Feb 28, 2018

Maybe it’s helpful to write it out a bit better how you would use the new API in the mindset of the old one:

render() {
  const optionsByOldApi = [
    { value: "v1", label: "l1" },
    { value: "v2", label: "l2" },
    { value: "v3", label: "l3" }
  ]
  return (
    <Select options={optionsByOldApi.map(o => o.label)} onChange={(newLabel, newIndex) => {
      // Either find the value by matching against the label, or just go by index
      // Keep doing business as usual
    } />
  )
}

Select is easier to use now (<Select options={["apples", "other fruit"]} /> just works), the <option> tag still gets a semantic value, and you can map things back quickly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Explorer Context Menu Enhancements - WinZip
Using the context menu​​ To use the context menu, simply right click on a file or folder in the Windows File Explorer. WinZip...
Read more >
CONCEPT: Improving Edge's context / right click menu
My new context menu proposes two major improvements. First, the menu cuts down on bulky elements by using the address bar versions of...
Read more >
Extending the Context Menu and Share Dialog in Windows 11
Windows 11 brings refinement to contextual file operations in the right-click context menu and share dialog. These are extensible by apps, ...
Read more >
Microsoft is Improving the Right-Click Menus in Windows 11
One of those improvements involves cleaning up the context menus, ... The new right-click context menu showing commands in windows 11.
Read more >
Windows 11's classic context menu is finally getting a better ...
Microsoft is testing the improved classic right-click menu in the Dev Channel of the Insider Program and it will eventually get better.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found