Praise be to Allah
The basic principle with regard to the woman whose husband has died is that she must remain in her husband’s house until her ‘iddah ends, because the Prophet (blessings and peace of Allah be upon him) said: “Stay in the house in which the news of your husband’s death came to you, until your ‘iddah is over.” Narrated by Ibn Maajah (2031); classed as saheeh by al-Albaani in Saheeh Ibn Maajah.
So it is not permissible for her to leave her husband’s house, except in the case of need or for some necessary purpose. Attending the Eid prayer does not come under that heading, as was stated by a number of scholars.
Ash-Shawkaani (may Allah have mercy on him) said, commenting on the hadith of Umm ‘Atiyyah about taking the women out to attend the Eid prayer:
This and similar hadiths indicate that it is prescribed for women to go out to the prayer-place on the two Eids, without differentiating between virgins and those who are married, young and old, those who are menstruating and those who are not, so long as the woman is not observing ‘iddah…
End quote from Nayl al-Awtaar (3/343)
Shaykh Ahmad al-Qaadi (may Allah preserve him) said in Thamaraat at-Tadween min Masaa’il Ibn ‘Uthaymeen:
I asked our shaykh – i.e., Ibn ‘Uthaymeen (may Allah have mercy on him): Can a recently-widowed woman go out to attend the Eid prayer? He (may Allah have mercy on him) replied: No. end quote.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) also said: A woman whose husband has died should remain in her house and not come out except for a legitimate shar‘i reason. As for her going out with no reason, that is not permitted.
Based on that, it is not permissible for her to go out to visit her neighbours or relatives, or to offer the Eid prayer and so on; rather she should remain in her house.
End quote from Fataawa Noor ‘ala ad-Darb.
For more information, please see the answer to question no. 96922
And Allah knows best.