How is "Average Time on Dimension" computed?

Does tracking time ends when dimension changes? Or does it store heartbeats on each page with that dimension and averages that?

This is an action dimension.

This is very different from “Avg time on page” although I do extract dimension from url.