Changed the method to calculate the position of the popup menu. It now uses the getBoudingClientRect method