This is is how girls' school uniforms in Japan nowadays are most commonly worn. Usually it's either the above knee-length gym shorts from the school's P.E. suit (e.g. post #6560334), or much shorter sports shorts such as dolphin shorts (e.g. post #6560191), though the former long-legged type typically only among middle school students, as high school girls prefer shorts that can't accidentally show even with short skirt lengths.
Wearing gym/sports shorts under skirts became popularized because it simplifies changing clothes between physical classes/activities, among other things. Despite this, pantyshots may still happen, due to tights commonly being worn in lieu of shorts.
Because of this, it's also becoming more and more common to see this reflected in anime and manga, being often depicted as the default among school girls in series with a "grounded" premise such as Horimiya, Takagi-san, or Asobi Asobase.
Bike shorts under skirt are a more tomboyish variant of this.