Skip to content

Instantly share code, notes, and snippets.

@Kaleidea
Created November 10, 2021 00:24
Show Gist options
  • Save Kaleidea/19851b737cf83cbf678504fbc643b08b to your computer and use it in GitHub Desktop.
Save Kaleidea/19851b737cf83cbf678504fbc643b08b to your computer and use it in GitHub Desktop.
<search> element migration guide with <form> functionality

How to migrate current application of role=search

Simple cases

  • <div role=search> -> <search>
  • <form role=search> -> <search action="">
  • <form role=search action="..."> -> <search action="...">

Nesting

  • <div role=search> ... <form> -> <search> ... <div>
  • If there are additional form controls in the <div> that shouldn't be submitted, those conceptually do not belong in search and should be refactored.
  • <form> ... <div role=search> -> <search> ... <div>
  • <form> ... <div role=search> where the form contains additional elements outside search is very rare: <form> <... role=search></...> + <...>. Anno ASP Forms resulted in a full-page <form>, where role=search would have been just one part of the form. A new element is not expected to be used with such old technology, therefore it is a better trade-off to not support this pattern.

Not <div> or <form>

Usage patterns

Note: Sourcegraph indexes open-source projects only. It does not cover the World Wide Web, but there are many public git scraping projects that mirror a piece of the Web.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment