The elf trance is often misunderstood as being that the long rest is only 4 hours whereas everyone else is 8 hours.
The only thing the elf trance does is you need to sleep "trance" for 4 hours, but still need the remaining 4 hours to gain the benefit of a long rest such as other light activity.
The benefit is such that the elves can keep watch for longer (up to 4 hours). Whereas most other humanoids need 6 hours of sleep and 2 hours of light activity (or 8 hours of sleep if you like sleep ofc).
8 Hours - 4 hour trance + 4 hour light activity/downtime.
Just for reference that elves do in fact need 8 hours for a long rest:
Thanks to Sarge in the comments, it seems Eladrin, Shadar-Kai and Sea Elves gain the benefit of a long rest after 4 hours, either by an error in MPMM or a change in the desired D&D design. I found no errata that changes the phrasing of the Trance for Eladrin & co, nor errata that changes the phrasing of the original PHB.
A character can’t benefit from more than one Long Rest in a 24-hour period, and a character must have at least 1 hit point at the start of the rest to gain its benefits.
The elf will be at 0 hit points until healed or unconcious for 1d4 hours, then 8 hour long rest if an elf from PHB or 4 hour long rest if Eladrin, Sea elf or Shadar-Kai.