The mw.util.addPortlet method has room for improvement:
- The portlet label is done with <label>, which is meant to be used within HTML forms only and is invalid for this case. Should be a <div>, probably with a class like mw-portlet-label.
- The <div> list wrapper should also have a class, to make targeting it with CSS easier: mw-portlet-body.
- There should be a check for the system message tooltip-[id], where [id] is the portlet ID, and if there is such a system message, it should be included as the portlet's title, as is done by Vector 2022.